SA-MP Forums Archive
What's wrong in the logic of the code? - 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: What's wrong in the logic of the code? (/showthread.php?tid=644781)



What's wrong in the logic of the code? - Ritzy2K - 14.11.2017

This code is supposed to let the player who're class 5 or 9 ride the armed vehicles. But this isn't letting ANYONE ride them, not even a single class.

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vehicleid = GetVehicleModel(GetPlayerVehicleID(playerid));
	if(vehicleid == 520 || vehicleid == 447 || vehicleid == 425 || vehicleid == 432)
	{
     	if(class[playerid] != 5 || class[playerid] != 9)
	    {
	        SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}Your Class must be Technician or Donator to Drive Armed Vehicles.");
	        RemovePlayerFromVehicle(playerid);
	        return 1;
		}
	}
	return 1;
}



Re: What's wrong in the logic of the code? - Gammix - 14.11.2017

Код:
class[playerid] != 5 && class[playerid] != 9
Use AND not OR!


Re: What's wrong in the logic of the code? - Ritzy2K - 14.11.2017

Quote:
Originally Posted by Gammix
Посмотреть сообщение
Код:
class[playerid] != 5 && class[playerid] != 9
Use AND not OR!
Thanks, I did a noob mistake :3