01.08.2011, 18:41
I have devised a way to count how many players are playing in a level on a server, however the count is always 1 higher than it actually is. Now i know i could just subtract 1 from the count and be done with this but that would not be good practice. I have spent some time modifying the loop, and have even included foreach but nothing will work, here is the code i'm working with.
Also, there are no errors upon compiling the code
pawn Код:
for(new i = 0; i < MAX_MODES; i++)
{
if(MODES[i][1][0] == 0) format(string, sizeof(string), "%s %s: {FF0000} Inactive\r\n", string, MODES[i][0]);
else
{
new players = 0;
foreach (Player, p)
{
if(PlayerData[p][MODE] == i) players++;
else continue;
}
format(string, sizeof(string), "%s %s: {00FF00} Active{FFFFFF} - Players: %i\r\n", string, MODES[i][0], players);
}
}