Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

I Tried to make aplugin but it said evaluation error please help

Comments in 'Plugin Development' started by Stever_, Dec 1, 2013.

  1. Stever_
    Offline

    Stever_ Ban Evader Banned

    Joined:
    Dec 1, 2013
    Posts:
    6
    Minecraft User:
    Stever_
    Im new to PHP so i did this plugin on my phone it worked then i edited it again and it said evaluation error
    • Heres the code
    • Code:
      <?php
      /*
      __PocketMine Plugin__
      name=Redstone Eggs
      description=spawn egg whit redstone texture
      version=1.0
      author=Stever_     
      class=CommandHandle
      apiversion=10
      */
      class CommandHandle implements Plugin{
        private $api;
        public function __construct(ServerAPI $api, $server = false){
          $this->api = $api;
        }
        public function init(){
          $this->api->console->register("mycommand","description beside command in /help", array($this, "CommandHandle"));
              $this->api->ban->cmdwhitelist("");
             
        }
        public function CommandHandle($cmd, $args, $issuer){
          $username = $issuer->username;
              switch($cmd){
                              case "opask":
                                            $this->api->chat->broadcast("[OpAsk]:[$username]Can I be op);
        break;
                                      }
              }
        public function __destruct(){
        }
      }
      ?>
      
      public function init(){
          $this->api->console->register("redstone","gives a player a spawn egg with redstone texture", array($this, "CommandHandle"));
              $this->api->ban->cmdwhitelist("run");
             
        }
        public function CommandHandle($cmd, $args, $issuer){
          $username = $issuer->username;
              switch($cmd){
                              case "redstone":
                                              $this->api->console->run("give $username 383:98 64");
      
  2. Xfusionios
    Offline

    Xfusionios Active Member Plugin Developer

    Joined:
    Aug 24, 2013
    Posts:
    67
    Plugins:
    2
    Minecraft User:
    XFusionios
    It should say the Line number and thats where the code is messed up.
    Edit:
    PHP:
    <?php
    /*
    __PocketMine Plugin__
    name=Redstone Eggs
    description=spawn egg whit redstone texture
    version=1.0
    author=Stever_  
    class=CommandHandle
    apiversion=10
    */
    class CommandHandle implements Plugin{
      private 
    $api;
      public function 
    __construct(ServerAPI $api$server false){
        
    $this->api $api;
      }
      public function 
    init(){
        
    $this->api->console->register("mycommand","description beside command in /help", array($this"CommandHandle"));
            
    $this->api->ban->cmdwhitelist("");
        
      }
      public function 
    CommandHandle($cmd$args$issuer){
        
    $username $issuer->username;
            switch(
    $cmd){
                            case 
    "opask":
                                          
    $this->api->chat->broadcast("[OpAsk]:[$username]Can I be op:");
                                        break;
                                    }
            }
      public function 
    CommandHandle($cmd$args$issuer){
        
    $username $issuer->username;
            switch(
    $cmd){
                            case 
    "redstone":
                                            
    $this->api->console->run("give ".$username." 383:98 64");
                            break;

      }}
        public function 
    __destruct(){
      }

      }
    Thats the fixed code i think. Also suggest learning at codeacademy.com
    Magnus-Noel likes this.
  3. Stever_
    Offline

    Stever_ Ban Evader Banned

    Joined:
    Dec 1, 2013
    Posts:
    6
    Minecraft User:
    Stever_
    it said evaulation error and thats all
  4. Stever_
    Offline

    Stever_ Ban Evader Banned

    Joined:
    Dec 1, 2013
    Posts:
    6
    Minecraft User:
    Stever_
    gonna help??????

    [​IMG]
  5. Stever_
    Offline

    Stever_ Ban Evader Banned

    Joined:
    Dec 1, 2013
    Posts:
    6
    Minecraft User:
    Stever_
    I cant keep the server down this long
    [​IMG]
  6. Xfusionios
    Offline

    Xfusionios Active Member Plugin Developer

    Joined:
    Aug 24, 2013
    Posts:
    67
    Plugins:
    2
    Minecraft User:
    XFusionios
    i edited my first post with the code fixed sorry.
  7. Stever_
    Offline

    Stever_ Ban Evader Banned

    Joined:
    Dec 1, 2013
    Posts:
    6
    Minecraft User:
    Stever_
    no problem i got help
  8. Bugs Bunny
    Offline

    Bugs Bunny Banned

    Joined:
    Dec 6, 2013
    Posts:
    11
    Minecraft User:
    Bugs Bunny
    This Shuld work
    PHP:
    <?php
    /*
    __PocketMine Plugin__
    name=Redstone Eggs
    description=spawn egg whit redstone texture
    version=1.0
    author=Stever_
    class=CommandHandle
    apiversion=10,11
    */
    class CommandHandle implements Plugin{
    private 
    $api;
    public function 
    __construct(ServerAPI $api$server false){
    $this->api $api;
    }
    public function 
    init() {
    $this->api->console->register("mycommand","description beside command in /help", array($this"CommandHandle"));
    $this->api->ban->cmdwhitelist("mycommand");
    }
    public function 
    CommandHandle($cmd$args$issuer){
    $username $issuer->username;
    switch(
    $cmd) {
    case 
    "opask":
    $this->api->chat->broadcast("[OpAsk]:[$username]Can I be op);
    break;
    }
    }
    public function __destruct(){
    }
    }
    ?>
  9. Magnus-Noel
    Offline

    Magnus-Noel New Member

    Joined:
    Nov 28, 2013
    Posts:
    7
    Bugs and I were thinking the same thing... actually we may have coded very similar but. It was correct,
    Code:
    <?php
    /*
    __PocketMine Plugin__
    name=Redstone Eggs
    description=spawn egg whit redstone texture
    version=1.0
    author=Stever_
    class=CommandHandling
    apiversion=10
    */
    class CommandHandling implements Plugin{$
    private $api;
    public function __construct(ServerAPI $api, $server = false){
    $this->api = $api;
    }
    public function in>it() {
    $this->api->console->register("mycommand","description beside command in /help", array($this, "CommandHandling"))
    $this->api->ban->cdwhitelist("mycommand"))$
    }
    public function CommandHandling($cmd, $ars, $issuer)
    $username = $issuer->username;
    switch($cmd) {
    case "opask":
    $this->api->chat->broadcast("[OpAsk]:[$username]Can I be op);
    break;
    }
    public function __destruct({
    }
    >
    I may have messed up a bit. But I'm pretty tired, so use bugs :p gosh I did bad...

Share This Page

Advertisement