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

Plugin making help

Comments in 'Plugin Development' started by Mclover152, May 17, 2014.

  1. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    Do you mean how to get the key of the $args array that contains a certain value?
    $key = array_search('p:a.permission', $args);
  2. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,130
    Plugins:
    4
    Minecraft User:
    iksaku
    Yes, thanks!
    BTW: I sent you a PM :)
  3. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    So what is $message equal to
  4. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    So is that what $message is equal to? (Wies's comment)
  5. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    Is this what $message ='s
    $this->api->console->register->("message", "<message> Sends a raw message in the chat", array($this, "send"));
    $this->api->ban->cmdwhitelist("message");
    }

    Public function commandHandler($cmd, $params, $issuer, $alias){
    $message = str_ireplace('p:a.permission', '', str_replace('&', '%', implode(' ', $args))));
    $this->api->chat->broadcast("$message");
    }
  6. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    What is $message equal to for this \/
    /say <MESSAGE>
  7. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    What you are looking for is most likely this:
    Code:
    public function commandHandler($cmd, $args, $issuer){
       $message = implode(' ', $args);
       $this->api->chat->broadcast($message);
    }
  8. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    Thank you
  9. Beast Mode
    Offline

    Beast Mode Banned

    Joined:
    Apr 4, 2014
    Posts:
    16
    I think in_array would be better to use than array_search
  10. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    I used the following coding and the command "message" never appeared on help list:
    $this->api->console->register("message", "<message> Sends a raw message", array($this, "send"));
    $this->api->ban->cmdwhitelist("message");
    }

    public function commandHandler($cmd, $args, $issuer){
    $message = implode(' ', $args);
    $this->api->chat->broadcast($message);
    }
  11. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    He asked for the key to the value, and in_array only returns true or false not the key
  12. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    I used the following coding and the command "message" never appeared on help list:
    $this->api->console->register("message", "<message> Sends a raw message", array($this, "send"));
    $this->api->ban->cmdwhitelist("message");
    }

    public function commandHandler($cmd, $args, $issuer){
    $message = implode(' ', $args);
    $this->api->chat->broadcast($message);
    }
  13. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    use cmdWhitelist instead of cmdwhitelist
  14. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    Never mind, its working
  15. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    The problem was i put "send" instead of commandHandler
  16. Beast Mode
    Offline

    Beast Mode Banned

    Joined:
    Apr 4, 2014
    Posts:
    16
    Oh ok
  17. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    1. More question:
    How do you notice the console when a player executes a command in-game, as in sending a message in to console.
  18. Anton Magsino
    Offline

    Anton Magsino Active Member

    Joined:
    Jan 17, 2014
    Posts:
    58
    Minecraft User:
    MinecrafterPH
    There's a plugin called CommandEcho by @ZacHack, but has been removed.
  19. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    Set debug=2 in "server.properties". Pretty sure that'll do it.
  20. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    Thank you. Now when i execute an in-game command it notifies me.

Share This Page

Advertisement