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;
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.
$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
Also do you know how to make it backup after a game has finished so its not griefed without server stop?
This might work. PHP: <?php/*__PocketMine Plugin__name=Request by codmadnessprodescription=Plugin created with PMMPPG by SuperChipsLPversion=1.0author=SuperChipsLPclass=7jgLD3liapiversion=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 codmadnessprodescription=Plugin created with PMMPPG by SuperChipsLPversion=1.0author=SuperChipsLPclass=qGaKytnAapiversion=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
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
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...
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
I am aiming to make a simple spleen plugin to release publicly, could take me some time though because I have midterms.