Hi All, I am hoping someone can help. I run a hunger game server using pocket hungergames by omattyao,. When the game starts it begins counting down and say every minute who long left. Ie. it broadcasts 15 minutes remaining 14 minutes remaining etc. What I want to do is when it reaches say 7 mins remaining to broadcast a message. The when reaches say 5 minutes remaining says a different message and the when it reaches say 1 minutes say another message. I can do this broadcast but it goes with the times of server uptime rather than game time. I also want it do this when game restarts so start again and withe 7 minutes say message again at 5 and then 1 again. Any ideas on how to query the game time remaining would be greatly appreciated. Kind regards Dougle_1
You can use a schedule that broadcast a message every x second/minute. Add this in the public function init(): PHP: $this->api->schedule($time, array($this, "timingSchedule"), array(), true); and replace $time with your time (1200 will display your message(s) every minute, 300 every 15 second...). Then create the function timingSchedule (or what did you call it): PHP: public function timingSchedule() { //remember to set it to public! $this->api->chat->broadcast("Your message."); $this->api->chat->broadcast("Another message.");} If you want to display a random message you can use: PHP: public function timingSchedule() { $message = rand(1, $maxMsg); //replace $maxMsg with the numer of your messages if($this->message == 1) { //first message $this->api->chat->broadcast("First message!"); } elseif($this->message == 2) { //second message $this->api->chat->broadcast("Second message!"); }} And add more elseif for all $maxMsg
Many Thanks for you help, am not that clued up on php scripting, command line is more my thing, although didnt use your exact code your explanation of the if clause really helped. Thanks Dougle_1