hi my name is jermy647. im trying to make a plugin that allows me to make a custom message when a player quits its bradcasts it and I also added a setting in the code to include the $issuer but I had an error when testing it so can anyone please help me. Thanks I will attach the php file to this thread.
You can't use issuer in event, try this: PHP: public function eventHandler($data, $event){ switch($event){ case "player.quit": $username = $data->username; $this->api->chat->broadcast("$username left the game"); }
when I tested out your new code I got this error: Parse error: syntax error, unexpected 'public' (T_PUBLIC) in C:\Users\Jeremy Haft\Desktop\PocketMine-MP use only\plugins\quit.php on line 35 04:47:08 [INFO] Unloading level "guest1"
I'm sorry, you need one } try this PHP: public function eventHandler($data, $event){ switch($event){ case "player.quit": $username = $data->username; $this->api->chat->broadcast("$username left the game"); }}
no never remove public function __destruct(){} or it will crash only if you have public function __create(){} i think at the beggining of the plugin
After the event, put the __destruct thing. By the way, for the custom message, I think you have to do $this->api->chat->broadcast($username." left the game");