public static function OnPlayerDisconnect(Player $player, $reasonid) { /* Remove from connected players list */ unset(Players::$players[$player->id]); Players::$players_by_id[$player->id] = null; /* Remove from JQ list */ Players::DelFromJQ($player); /* Remove from OOC list */ Players::DelFromOOC($player); /* Send the quit info to players who requested it */ $reason = Core::TranslateQuitReason($reasonid); if ($player->account && $player->account->Authed()) { foreach (Players::$players_jq as $p) { $p->Send(COLOR_GRAY, "[QUIT] {$player->name}({$player->id}) has quitted ({$reason})"); } } if (Players::$upgrade_draws[$player->id] != null) { TextDrawDestroy(Players::$upgrade_draws[$player->id]); Players::$upgrade_draws[$player->id] = null; } if ($player->account) { $player->SetName($player->account->name); } Log::Append(LOG_JOINQUIT, "[{$player->id}] {$player->name}({$player->ip}) disconnected ({$reason})"); $player->Destroy(); return CALLBACK_OK; }
private static function UnregisterPlayer(Player $player) { if (Gym::$players_key[$player->id] != -1) { Gym::$players_key[$player->id] = -1; Gym::$players_gained[$player->id] = -1; if (Gym::$draws[$player->id] !== null) { TextDrawDestroy(Gym::$draws[$player->id]); Gym::$draws[$player->id] = null; } foreach (Gym::$machines as $machine) { if ($machine->player && $machine->player->id == $player->id) { $machine->player = null; break; } } } }