[Include] PlayerLoop - Skips unconnected players
#12

Quote:
Originally Posted by Kar
Посмотреть сообщение
pawn Код:
for(new id = 0; id < pl_MaxPlayers; id ++)
    {
        if(IsPlayerConnected(id) && playerid != id)
        {
            pl_Players[pl_Connected] = id;
            pl_Connected ++;
        }
        else
            pl_Players[id] = INVALID_PLAYER_ID;
    }
This MIGHT not work. Imagine this scenario, because this is what your code would do:
Код:
Playerid 0 Connected, pl_Players[0] = 0
Playerid 1 Not connected, pl_Players[1] = INVALID_PLAYER_ID
Playerid 2 Connected, pl_Players[1] = 2
Playerid 3 Connected, pl_Players[2] = 3
Playerid 4 Not connected, pl_Players[4] = INVALID_PLAYER_ID
... And the rest of the players are disconnected.
So what happened to Index 3? Nothing.
Reply


Messages In This Thread
PlayerLoop - Skip unconnected players - by RedFusion - 19.06.2014, 14:28
Re: PlayerLoop - Skips unconnected players - by Richie© - 19.06.2014, 14:50
Re: PlayerLoop - Skips unconnected players - by SimonItaly - 19.06.2014, 15:12
Re: PlayerLoop - Skips unconnected players - by RedFusion - 19.06.2014, 15:21
Respuesta: PlayerLoop - Skips unconnected players - by Swedky - 19.06.2014, 15:55
Re: PlayerLoop - Skips unconnected players - by Kar - 19.06.2014, 18:51
Re: PlayerLoop - Skips unconnected players - by RedFusion - 19.06.2014, 19:01
Re: PlayerLoop - Skips unconnected players - by [WSF]ThA_Devil - 19.06.2014, 19:05
Re: PlayerLoop - Skips unconnected players - by Kar - 19.06.2014, 19:07
Re: PlayerLoop - Skips unconnected players - by RedFusion - 19.06.2014, 19:13
Re: PlayerLoop - Skips unconnected players - by Kar - 19.06.2014, 19:52
Re: PlayerLoop - Skips unconnected players - by RedFusion - 19.06.2014, 19:58
Re: PlayerLoop - Skips unconnected players - by Kar - 19.06.2014, 20:43
Re: PlayerLoop - Skips unconnected players - by iRaiDeN - 20.06.2014, 19:21
Re: PlayerLoop - Skips unconnected players - by StreetGT - 20.06.2014, 20:27
Re: PlayerLoop - Skips unconnected players - by iRaiDeN - 20.06.2014, 20:37
Re: PlayerLoop - Skips unconnected players - by Patrick - 20.06.2014, 20:45
Re: PlayerLoop - Skips unconnected players - by iRaiDeN - 20.06.2014, 20:48
Re: PlayerLoop - Skips unconnected players - by RedFusion - 21.06.2014, 11:23
Re : PlayerLoop - Skips unconnected players - by S4t3K - 21.06.2014, 11:54

Forum Jump:


Users browsing this thread: 1 Guest(s)