I was wondering in php is there a way to have a timed command! Where you lets say you run /kit starter you can set a cool down so it can't be ran for 24 Hours! PHP: for ($i = *start time*; $i = *end time*; $i += *time interval*) { echo $i;} Maybe something like this? I meam I have no idea , so any help would help lol!
You have to use something like this (it's not a beautiful but works) (does not work if you reboot) PHP: <?phpnamespace Server;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\event\Listener;use pocketmine\plugin\PluginBase;use pocketmine\utils\TextFormat;class Main extends PluginBase implements Listener{ public $kitTick = []; public function onLoad(){ $this->getLogger()->info(TextFormat::WHITE . "Server plugin loaded"); } public function onEnable() { } public function onCommand(CommandSender $sender, Command $command, $label, array $args){ switch ($command){ case "blabla": if(!isset($this->kitTick[$sender->getName()]) or ($this->kitTick[$sender->getName()] - $this->getServer()->getTick()) >= 20*60*60*24){ $this->kitTick[$sender->getName()] = $this->getServer()->getTick(); //WhatCOmmandHasToDO }else{ $sender->sendMessage("You can't use this command. You have to wait ".($this->kitTick[$sender->getName()] - $this->getServer()->getTick())/(20*60)." minutes."); break; } } }}
Just save the time of when the command was last ran somewhere and check if the current time has a difference of lets say more than a day (86400 seconds).
A database can also refer to a well planned custom implemented database, like the YAML files in SimpleAuth; it's still a database. But I won't call one simple YAML file a database. (SQLite3 is an exception)