Пример #1
0
            }
            break;
        case "showChat":
            echo displayChat($lid);
            break;
        case "newMessage":
            if ($message) {
                echo newMessage($uid, $lid, $message);
            }
            break;
    }
}
if ($lid) {
    switch ($request) {
        case "lobbyinfo":
            $lobbyinfo = $lobby->lobbyinfo();
            $lobbyplayers = $lobby->lobbyData();
            $count = countPlayers($lid);
            updateLobbyReady($lid);
            if ($lobby->status == "ready") {
                removeOfflinePlayers(checkOfflinePlayers($lid));
            }
            $array = array('id' => $uid, 'ready' => readystatus($id, true), 'inlobby' => isPlayerInLobby($uid), 'info' => $lobbyinfo, 'count' => $count, 'players' => $lobbyplayers);
            echo json_encode($array);
            break;
        case "lobbyplayers":
            echo json_encode($lobby->lobbyData());
            break;
        case "distance":
            if ($lat && $lon) {
                $server = new Server($lobby->lobbyserver($lid));