Check if in same vehicle - 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: Check if in same vehicle (
/showthread.php?tid=66836)
Check if in same vehicle -
DeerHooves - 24.02.2009
Quick question here, I couldn't find an example in search.
With using a command, how could I go about checking if both players are in the same vehicle?
Re: Check if in same vehicle -
Salmon - 24.02.2009
Try this, I think it should work.
pawn Код:
new player1carid = GetPlayerVehicleID(playerid);
new player2carid = GetPlayerVehicleID(playerid2); //Replace playerid2 with the id of player 2!
if (player1carid == player2carid)
{
//They are in the same car! Do stuff here
}