Hello, Im working on a plugin that will require me to use the API Schedules. My issue is that when i run the schedule (which starts after a command is sent) and it goes to the finction for after the time, it doesnt know the parameters that it neds anymore. Heres what i mean: PHP: public function CommandHandler($cmd, $params, $issuer, $alias){ switch(strtolower($cmd)) { case "timercommand": if(count($params) > 3 || $params[0] == "help"){ return "Usage: /timercommand <SECONDS> <COMMAND> <PLAYER>"; } $secs = strtoupper($params[0]); $cmd = strtoupper($params[1]); $player = strtoupper($params[2]); $this->api->schedule($secs*20, array($this, "timer")); }} So obviously what this is doing is setting up the command that will be run after a set amount of time (in seconds) Now to show you where the issue starts... PHP: public function timer($cmd, $params, $issuer, $alias){ if(isset($player)){ $this->api->console->run($cmd." ".$player); }else{ $this->api->console->run($cmd); } console("[INFO] [TimerCommand] Command run sucesfully!");} The error i get from this is: Code: [ERROR] A E_WARNING error happened: "Missing argument 3 for TimerCommand::timer()" in "/private/var/PocketMine-MP/plugins/TimerCommand.php" at line 52 [ERROR] A E_WARNING error happened: "Missing argument 4 for TimerCommand::timer()" in "/private/var/PocketMine-MP/plugins/TimerCommand.php" at line 52 I have no idea why im getting this error... Could someone please help? Thanks!
To supply parameters in a scheduled function, you need this: PHP: $server->schedule($ticks, $callable, $anyParametersYouWantToPass, $doYouWantToRepeatItAfter);function callable($dataWhichIsTheThirdParameterAbove){}