SA-MP Forums Archive
Error with IF conditions - 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 with IF conditions (/showthread.php?tid=621777)



Error with IF conditions - HidroDF - 14.11.2016

Hello, I'm having troubles with a simple expression. I have this:

Код:
if (GetVehicleModel(vehicleid) == 574)
	    {
	        if(PlayerInfo[playerid][pJob] != 2 || PlayerInfo[playerid][pJob2] != 2)
	        {
	   	   		SendClientMessage(playerid, -1, "{40D3FF}You are not working as Sweeper!");
	   	   		SetTimerEx("unfreeze", 200, false, "i", playerid);
	        }
	        else
	        {
	   	   		SendClientMessage(playerid, -1, "{40D3FF}You are working as Sweeper!");
		}
PlayerInfo[playerid][pJob] is equal to 1 and PlayerInfo[playerid][pJob2] is equal to 2 and I'm reciving the error message. Anyone knows why? || is OR, [Job] is 1 so it's false but Job2 is 2 so it's true.
I've made a command to check it:

Код:
CMD:j2(playerid, params[])
{
	new str[240];
	format(str, sizeof(str), "job 2: %d", PlayerInfo[playerid][pJob2]);
	SendClientMessage(playerid, -1, str);
	return 1;
}
And returns:

Код:
job 2: 2



Re: Error with IF conditions - iLearner - 14.11.2016

Use && not ||