示例#1
0
 public function lobbyData()
 {
     $data = array('blu' => grabLobbyPlayers($this->id, $this->type, 1), 'red' => grabLobbyPlayers($this->id, $this->type, 2), 'spec' => grabLobbyPlayers($this->id, $this->type, 0), 'size' => teamplayers($this->type));
     return $data;
 }
示例#2
0
     }
     break;
 case "startGame":
     $server = new Server($lobby->lobbyserver($lid));
     if ($server->id == 1) {
         $location = getPlayersLocation($lid);
         $servers = getOnlineServers();
         $server = new Server(bestServer($location, $servers));
         updateLobbyServer($lid, $server->id);
     }
     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":
示例#3
0
function updateLobbyReady($lid)
{
    $lobby = new Lobby($lid);
    $cond = countPlayers($lid) == 2 * teamplayers($lobby->type);
    if ($cond && $lobby->status == "open") {
        changeLobby($lid, 'status', 'ready');
    }
    if ($lobby->status == "ready" && !$cond) {
        changeLobby($lid, 'status', 'open');
    }
}