SA-MP Forums Archive
forbidden vehicle script problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: forbidden vehicle script problem (/showthread.php?tid=182443)



forbidden vehicle script problem - nejc001 - 10.10.2010

So i have a script like this:
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
   new vehicle;
	vehicle = GetVehicleModel(vehicleid); 
  if(vehicle == 425 || 447 || 520 || 432)
	{
		new Float:x, Float:y, Float:z;
       	GetPlayerPos(playerid,x,y,z);	SetPlayerPos(playerid,x,y,z+4);
		SendClientMessage(playerid,0xFF9900AA,"This is a forbidden vehicle.");
  }

	return 1;
 	
}
But, script works on any kind of vehicles, not only on those i wrote.
Help?


Re: forbidden vehicle script problem - Mauzen - 10.10.2010

pawn Код:
if(vehicle == 425 || 447 || 520 || 432)
You cant compare it like this, because it would check if the following is true
vehicle == 425 (ok)
or
447 (>= 1 so its always true)
or
...

Do it like this:
pawn Код:
if(vehicle == 425 || vehicle == 447 || vehicle == 520 || vehicle == 432)



Re: forbidden vehicle script problem - nejc001 - 10.10.2010

-.-
i failed

ty for help