SA-MP Forums Archive
Error help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Error help (/showthread.php?tid=449309)



Error help - trolltomax - 08.07.2013

Код:
stock SendClientMessageToAdmins(color,string[],level)
{
	foreach(Player, i)
	{
	    if(!IsPlayerConnected(i)) return 1;
		if(PlayerInfo[i][pAdmin] >= level && Connected[i] == 1) //246 LINE
		{
			SendClientMessage(i, color, string);
			//printf("%s", string);
		}
	}
	return 1;
}
Код:
C:\Users\Antonio\Desktop\SAMP\gamemodes\gmbeta.pwn(246) : error 017: undefined symbol "Connected"
C:\Users\Antonio\Desktop\SAMP\gamemodes\gmbeta.pwn(246) : warning 215: expression has no effect
C:\Users\Antonio\Desktop\SAMP\gamemodes\gmbeta.pwn(246) : error 001: expected token: ";", but found "]"
C:\Users\Antonio\Desktop\SAMP\gamemodes\gmbeta.pwn(246) : error 029: invalid expression, assumed zero
C:\Users\Antonio\Desktop\SAMP\gamemodes\gmbeta.pwn(246) : fatal error 107: too many error messages on one line



Re: Error help - Konstantinos - 08.07.2013

Just remove it, you already check if he's connected or not. In a loop, when someone is not connected, we skip (continue;), we do not return 1 because the loops stops.
pawn Код:
stock SendClientMessageToAdmins(color, const string[], level)
{
    foreach(Player, i)
    {
        if(!IsPlayerConnected(i)) continue;
        if(PlayerInfo[i][pAdmin] >= level)
        {
            SendClientMessage(i, color, string);
            //printf("%s", string);
        }
    }
}
And update your foreach. The latest version becomes
pawn Код:
foreach(new p : Player) // An Example!



Re: Error help - trolltomax - 08.07.2013

work,thanks.