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

/kickall {REASON}

Comments in 'Plugin Development' started by ViperSniper, Jun 8, 2014.

  1. ViperSniper
    Offline

    ViperSniper New Member

    Joined:
    Jun 5, 2014
    Posts:
    21
    Minecraft User:
    ViperSniper
    The title reads it all,
    This would be simple using:
    for($users as $user) {
    execute("kick " . $user . " " . $args[1]);
    }

    But i'd like it to not kick the issuer also.
    Could someone develop this please?

    Thanks, ViperSniper
    Last edited: Jun 8, 2014
  2. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney
    Mayby use :
    PHP:
    $this->api->console->run("kick $user $args[1]");
  3. iksaku
    Offline

    iksaku Notable Member Plugin Developer

    Joined:
    Sep 2, 2013
    Posts:
    1,132
    Plugins:
    4
    Minecraft User:
    iksaku
    PHP:
    foreach($online_players as $p){
    if(
    $p != $issuer){
      
    $p->kick("reason");
    }
    }
  4. ViperSniper
    Offline

    ViperSniper New Member

    Joined:
    Jun 5, 2014
    Posts:
    21
    Minecraft User:
    ViperSniper
    Could you develop it as a plugin with /kickall {reason} command please?
  5. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    435
    Plugins:
    4
    Minecraft User:
    Lambo
    PHP:
    if(isset($args[0])){if(args[0]=="all"){
       foreach(
    $this->api->player->getAll() as $p$this->api->console->run("kick ".$p->username);
    }}
  6. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    435
    Plugins:
    4
    Minecraft User:
    Lambo
    I will just a min
  7. ViperSniper
    Offline

    ViperSniper New Member

    Joined:
    Jun 5, 2014
    Posts:
    21
    Minecraft User:
    ViperSniper
    I haven't made a plugin before, can you turn that into a API12 plugin that reacts to /kickall {user}

    Please?
  8. ViperSniper
    Offline

    ViperSniper New Member

    Joined:
    Jun 5, 2014
    Posts:
    21
    Minecraft User:
    ViperSniper
    That's not exactly how I want it. i'd like a se[erafe command called /kickall {reason}
  9. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    435
    Plugins:
    4
    Minecraft User:
    Lambo
    PHP:
    <?php
    /*
    __PocketMine Plugin__
    name=Kickall
    description=
    version=1.0b
    author=Lambo
    class=Kickall
    apiversion=12
    */

    class Kickall implements Plugin{
        private 
    $api;

        public function 
    __construct(ServerAPI $api$server false){
            
    $this->api $api;
        }

        public function 
    init(){
          
    $this->api->console->register('kickall'"<reason>", array($this'commandHandler'));
        }

        public function 
    commandHandler($cmd$params$issuer$alias){
          if(
    $cmd=="kickall"){
            
    $reason=null;
            if(isset(
    $params[0])){
              for(
    $i=0;$i<count($params);$i++){
                
    $reason.=$params[$i];
              }
            }
            foreach(
    $this->api->player->getAll() as $players){
              if(
    $players->username !== $issuer->username$this->api->console->run("kick ".$players->username." ".$reason);
            }
          }
        }

        public function 
    __destruct(){
        }
    }

    ?>
  10. ViperSniper
    Offline

    ViperSniper New Member

    Joined:
    Jun 5, 2014
    Posts:
    21
    Minecraft User:
    ViperSniper
    Thank you ever so much!
  11. ViperSniper
    Offline

    ViperSniper New Member

    Joined:
    Jun 5, 2014
    Posts:
    21
    Minecraft User:
    ViperSniper
    Unexpected { line 12
  12. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    435
    Plugins:
    4
    Minecraft User:
    Lambo
    I didn't get that error, you copied the code correctly?
  13. ViperSniper
    Offline

    ViperSniper New Member

    Joined:
    Jun 5, 2014
    Posts:
    21
    Minecraft User:
    ViperSniper
    Yeah, can you put in in a .php file incase pls?
  14. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    435
    Plugins:
    4
    Minecraft User:
    Lambo
  15. ViperSniper
    Offline

    ViperSniper New Member

    Joined:
    Jun 5, 2014
    Posts:
    21
    Minecraft User:
    ViperSniper
  16. ViperSniper
    Offline

    ViperSniper New Member

    Joined:
    Jun 5, 2014
    Posts:
    21
    Minecraft User:
    ViperSniper
  17. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    203
    Plugins:
    3
    Minecraft User:
    Heromine14
    You know normal is possible to do /kick @all without plugin, just for say
  18. ViperSniper
    Offline

    ViperSniper New Member

    Joined:
    Jun 5, 2014
    Posts:
    21
    Minecraft User:
    ViperSniper
    What
  19. ViperSniper
    Offline

    ViperSniper New Member

    Joined:
    Jun 5, 2014
    Posts:
    21
    Minecraft User:
    ViperSniper
    I'm a time waster *megusta*, thanks for your efforts
  20. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    435
    Plugins:
    4
    Minecraft User:
    Lambo
    lol

Share This Page

Advertisement