I have a task that is called every 5 seconds, and in it I use get_players to retrieve all players, and loop through them to get team player counts and team alive counts since I've read that team flags on get_players can return false values sometimes.
I was wondering if having two global variables such as
PHP Code:
g_iConnected
g_iPlayers[32]
and storing and deleting players as
PHP Code:
client_putinserver(id){
g_iPlayers[g_iConnected++]
}
client_disconnect(id){
for(new i = 0; i < g_iConnected; i++)
if(g_iPlayers[i] == id)
g_iPlayers[i] = g_iPlayers[--g_iConnected]
break
}
would be a good idea to avoid calling get_players and looping so often. In this way I would also store team counts and alive counts in global vars.
What would be better?