Hi, I want to ban player for selected amount of days.. I have tried it, but all time it's bugging all times (because my maths is on low level) Here I add ban to player: PHP: public static function addBan($player,$days){ $time = time() / 1000; self::getConnection()->query ( "UPDATE players SET bantime = '".$time."' WHERE name = '".self::getConnection()->escape_string(trim(strtolower($player)))."'" ); $final = $days * 86400; self::getConnection()->query ( "UPDATE players SET bandays = '".$final."' WHERE name = '".self::getConnection()->escape_string(trim(strtolower($player)))."'" ); echo 'Banned player ' . $player . ' for ' . $days . ' days.'; } and then I check time that player is banned PHP: public function onJoin(PlayerJoinEvent $e){ $p = $e->getPlayer(); if(DatabaseManager::getPlayer($p->getName()) == null){ DatabaseManager::registerPlayer($p->getName()); $p->sendMessage("§aYou we're registred into database!"); } if(DatabaseManager::getPlayer($p->getName())['bandays'] !== 0){ $duration = time() / 1000 - DatabaseManager::getPlayer($p->getName())['bantime']; if($duration > DatabaseManager::getPlayer($p->getName())['bantime']){ $p->sendMessage('§cYour ban expired!'); }else{ $p->sendMessage('§eYour ban expire in: ' . $duration); } } } but when it say when ban expire it say things like -0.24399999994785 etc.. :/ and I want it to say days that is player banned... I can't find what I'm doing bad.. DatabaseManager::getPlayer($p->getName())['bantime'] is time() / 1000 when player was banned and DatabaseManager::getPlayer($p->getName())['bandays'] is number of days * 86400 to get seconds of days player is banned for. EDIT: I'm saving all data into MySQL
Checkout date() (http://php.net/manual/en/function.date.php) and time() (http://php.net/manual/en/function.time.php)
Check out this: https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/permission/BanList.php#L102 There is a time argument for timed bans.