Example #1
0
            }
            startLobby($lid);
            $players = teamplayers($lobby->type) * 2;
            $server->loadConfig($players, etf2l, $lobby->map);
            break;
        case "joinGame":
            if (!isPlayerInLobby($uid) && countPlayers($lid) != 2 * teamplayers($lobby->type)) {
                joinLobby($uid, $lid);
            }
            if (isPlayerInLobby($uid) != $lid) {
                echo '0';
            }
            break;
        case "leaveLobby":
            if (isPlayerInLobby($uid) == $lid) {
                leaveLobby($id);
            }
            if ($lobby->leader == $uid && countPlayers($lid) == 0) {
                deleteLobby($lid);
            }
            break;
        case "showChat":
            echo displayChat($lid);
            break;
        case "newMessage":
            if ($message) {
                echo newMessage($uid, $lid, $message);
            }
            break;
    }
}
Example #2
0
function removeOfflinePlayers($players)
{
    foreach ($players as $player) {
        leaveLobby(getLPid($player, isPlayerInLobby($player)));
    }
}