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

Help with spleef plugin

Comments in 'Plugin Development' started by codmadnesspro, Nov 18, 2013.

  1. codmadnesspro
    Offline

    codmadnesspro Notable Member Plugin Developer

    Joined:
    Sep 11, 2013
    Posts:
    551
    Plugins:
    1
    Minecraft User:
    Codmadnesspro
    How do I make this code below so when people join it bans them infill the next game
    case "player.spawn":
    if (!$this->switch["server.gate"]) {
    $data->blocked = true;
    $data->sendChat(" ");
    $data->sendChat(" ");
    $data->sendChat(" ");
    $data->sendChat("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
    $data->sendChat(" ");
    $data->sendChat("[SpleefGames] Now the tournament is going on.");
    $data->sendChat("[SpleefGames] Please join later.");
    $data->sendChat(" ");
    $data->sendChat("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
    $data->close("game is going on.", false);
    $this->broadcast("<server> ".$data->username." left the game.");
    return false;
    Syriamanal likes this.
  2. Syriamanal
    Offline

    Syriamanal Ban Evader Banned

    Joined:
    Oct 2, 2013
    Posts:
    221
    Minecraft User:
    Syriamanal
    i can help u but are u going to realses the plugin publicly or no
  3. codmadnesspro
    Offline

    codmadnesspro Notable Member Plugin Developer

    Joined:
    Sep 11, 2013
    Posts:
    551
    Plugins:
    1
    Minecraft User:
    Codmadnesspro
    It will be private
  4. codmadnesspro
    Offline

    codmadnesspro Notable Member Plugin Developer

    Joined:
    Sep 11, 2013
    Posts:
    551
    Plugins:
    1
    Minecraft User:
    Codmadnesspro
    Your choice if you want to.
  5. 0becca0
    Offline

    0becca0 New Member

    Joined:
    Oct 4, 2013
    Posts:
    133
    Minecraft User:
    0becca0
    aawe :( I got excited for a second until I read our was private. makes me wish I was smart to even make six like this.
  6. ZacHack
    Offline

    ZacHack Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    325
    Plugins:
    6
    Minecraft User:
    _ZacHack_
    $this->API->console->run("ban ".$data->username."");
    Then you have to go to when it lets people join and do this $this->API->console->run(... Wait I have a better idea just whitelist it until games over then unwhitelist it when it's open again. With $this->API->console->run("whitelist on"); or off
  7. codmadnesspro
    Offline

    codmadnesspro Notable Member Plugin Developer

    Joined:
    Sep 11, 2013
    Posts:
    551
    Plugins:
    1
    Minecraft User:
    Codmadnesspro
    I depends who helps me
  8. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Why can't you just kick them if they are not in the game?
  9. codmadnesspro
    Offline

    codmadnesspro Notable Member Plugin Developer

    Joined:
    Sep 11, 2013
    Posts:
    551
    Plugins:
    1
    Minecraft User:
    Codmadnesspro
    Its spleef automatic
  10. codmadnesspro
    Offline

    codmadnesspro Notable Member Plugin Developer

    Joined:
    Sep 11, 2013
    Posts:
    551
    Plugins:
    1
    Minecraft User:
    Codmadnesspro
    Also do you know how to make it backup after a game has finished so its not griefed without server stop?
  11. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    This might work. ;)
    PHP:
    <?php

    /*
    __PocketMine Plugin__
    name=Request by codmadnesspro
    description=Plugin created with PMMPPG by SuperChipsLP
    version=1.0
    author=SuperChipsLP
    class=7jgLD3li
    apiversion=10
    */

        
    class 7jgLD3li implements plugin{

        private 
    $api;

        public function 
    __construct(ServerAPI $api$server false){

            
    $this->api $api;

        }

        public function 
    init(){

        
    $this->api->addHandler("player.connect", array($this"eventHandler"), 100);

        }
     
        public function 
    eventHanlder($data$event)
        {
        switch(
    $event)
        {
            case 
    'player.connect':
         
    if (!
    $this->switch["server.gate"]) {
    $data->blocked true;
    $data->sendChat(" ");
    $data->sendChat(" ");
    $data->sendChat(" ");
    $data->sendChat("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
    $data->sendChat(" ");
    $data->sendChat("[SpleefGames] Now the tournament is going on.");
    $data->sendChat("[SpleefGames] Please join later.");
    $data->sendChat(" ");
    $data->sendChat("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
    $data->close("game is going on."false);
    $this->broadcast("<server> ".$data->username." left the game.");
    return 
    false;
         
            break;
        }

        }

        public function 
    __destruct(){

        }

    }
    edit: Most of the code would be useless when a player spawns. He doesn't see the code.
    Here is the code, so everyone will not be able to connect. Put in your if question!

    PHP:
    <?php

    /*
    __PocketMine Plugin__
    name=Request by codmadnesspro
    description=Plugin created with PMMPPG by SuperChipsLP
    version=1.0
    author=SuperChipsLP
    class=qGaKytnA
    apiversion=10
    */

        
    class qGaKytnA implements plugin{

        private 
    $api;

        public function 
    __construct(ServerAPI $api$server false){

            
    $this->api $api;

        }

        public function 
    init(){

        
    $this->api->addHandler("player.connect", array($this"eventHandler"), 100);

        }
      
        public function 
    eventHanlder($data$event)
        {
        switch(
    $event)
        {
            case 
    'player.connect':
          
              return 
    false;
          
            break;
        }

        }

        public function 
    __destruct(){

        }

    }
    edit2:

    PHP:
    $this->broadcast("<server> ".$data->username." left the game.");
    This might crash the server.
    Also, this message will be displayed twice, then :p
    Last edited: Nov 18, 2013
  12. Syriamanal
    Offline

    Syriamanal Ban Evader Banned

    Joined:
    Oct 2, 2013
    Posts:
    221
    Minecraft User:
    Syriamanal
    do $this->API->console->run("whitelist on"); cus if u do ban it will just bann them then u would have to un ban them lol
  13. Syriamanal
    Offline

    Syriamanal Ban Evader Banned

    Joined:
    Oct 2, 2013
    Posts:
    221
    Minecraft User:
    Syriamanal
    I'm all most done with my spleef plugin lol yes just some testing ok
  14. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    release ut and YOU BE AWESOME!!! ;)
  15. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You mean you want to kick the player if the spleef is on?
    public function playerJoin($data,$event){
    if(!$this->allowJoin)$this->api->console->run("kick ".$player);
    }

    But I don't think this is what you want...
  16. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Don't ban them. Just kick them.
  17. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    But look at my signature and DO THAT.
  18. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    The code their using the PocketHungerGames they using it as a template!! copy make original!!!
  19. Syriamanal
    Offline

    Syriamanal Ban Evader Banned

    Joined:
    Oct 2, 2013
    Posts:
    221
    Minecraft User:
    Syriamanal
    No I want to keep it privet sorry then no one would join I just hope willoim tdr doesn't make a spleef plugin lol:D
    PEMapModder likes this.
  20. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    I am aiming to make a simple spleen plugin to release publicly, could take me some time though because I have midterms.

Share This Page

Advertisement