Error with IF conditions
#1

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
Reply
#2

Use && not ||
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)