SA-MP Forums Archive
I can use something like IsPlayerInVehicle(playerid, vehicleid) in a NPC script? - 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: I can use something like IsPlayerInVehicle(playerid, vehicleid) in a NPC script? (/showthread.php?tid=122187)



I can use something like IsPlayerInVehicle(playerid, vehicleid) in a NPC script? - CTCCoco - 20.01.2010

I can use something like IsPlayerInVehicle(playerid, vehicleid) in a NPC script?


Thanks for all help.


Re: I can use something like IsPlayerInVehicle(playerid, vehicleid) in a NPC script? - Correlli - 20.01.2010

No, but you can use GetPlayerVehicleID function.

So you can do something like this:
pawn Код:
if(GetPlayerVehicleID(playerid) == vehicleid)
{
  // code.
}
or your own function:
pawn Код:
stock IsPlayerInVehicle(playerid, vehicleid)
{
  if(GetPlayerVehicleID(playerid) == vehicleid) return true;
  return false;
}