Loop problem
#1

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..

Код:
#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;
				}
maybe instead of LEOOnline++; i should use LEOOnline += 1; ?
Reply


Messages In This Thread
Loop problem - by Lidor124 - 01.10.2013, 16:22
Re: Loop problem - by Lidor124 - 01.10.2013, 17:43
Re: Loop problem - by DanishHaq - 01.10.2013, 17:46
Re: Loop problem - by Lidor124 - 01.10.2013, 19:21
Re: Loop problem - by iZN - 01.10.2013, 19:25
Re: Loop problem - by Lidor124 - 01.10.2013, 19:30
Re: Loop problem - by iZN - 01.10.2013, 19:31
Re: Loop problem - by Dragonsaurus - 01.10.2013, 19:34
Re: Loop problem - by Lidor124 - 01.10.2013, 19:35
Re: Loop problem - by Lidor124 - 01.10.2013, 19:37

Forum Jump:


Users browsing this thread: 1 Guest(s)