Is there a way to... - 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: Is there a way to... (
/showthread.php?tid=524761)
Is there a way to... -
Rufio - 08.07.2014
Get the driver's ID whenever a passenger gets in a car ? I have got no idea how to do it...
Re: Is there a way to... -
Cena44 - 08.07.2014
OnPlayerEnterVehicle or OnPlayerStateChange then you can detect the driver's id using GetPlayerVehicleSeat.
Re: Is there a way to... -
thimo - 08.07.2014
I think this will do the trick... Not sure because i did not actually test it.
pawn Код:
OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new Vehicle = GetPlayerVehicleID(playerid);
new string[128];
for(new i; i < MAX_PLAYERS; i++)
{
new driverSeat = GetPlayerVehicleSeat(i);
if(driverSeat == 0)
{
format(string, sizeof(string), "ID: %i is the driver", i);
SendClientMessage(playerid, 0xFFFFFFF, string);
}
}
}
Re: Is there a way to... -
Virtual1ty - 08.07.2014
Simples, like Cena said use OnPlayerStateChange, check if the player is a passenger, get the vehicle id he is in and then loop through players in range and check if they're inside a vehicle (as a driver) and see if the vehicle id matches the one the passenger is in.
Note: do not use OnPlayerEnterVehicle as they're not in the vehicle yet.