01.10.2013, 16:22
Hi all again..
In my bank robbery (almost finished) i using loop for players who are cop if they connect to the server, if they dont so it won't count them as cop.
when player connects as cop all works perfect but when he disconnect the counting still counts him as cop also if he logged out.
So... here my code with the loop - i tried put LEOOnline--; under public OnPlayerDisconnect but still keep counting :/
What's wrong with this code ? and why after disconnect its -1 ? its IsPlayerConnected(i) so..
maybe instead of LEOOnline++; i should use LEOOnline += 1; ?
In my bank robbery (almost finished) i using loop for players who are cop if they connect to the server, if they dont so it won't count them as cop.
when player connects as cop all works perfect but when he disconnect the counting still counts him as cop also if he logged out.
So... here my code with the loop - i tried put LEOOnline--; under public OnPlayerDisconnect but still keep counting :/
What's wrong with this code ? and why after disconnect its -1 ? its IsPlayerConnected(i) so..
Код:
#pragma unused params if(IsPlayerConnected(playerid)) { for (new i = 0; i < MAX_PLAYERS; i++) if (IsPlayerConnected(i) && (PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1)) LEOOnline++; if(LEOOnline < 4) { SendClientMessage(playerid, COLOR_GRAD3, "You need at least 4 Law Enforcement officers!"); return 1; }