SA-MP Forums Archive
car define - 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: car define (/showthread.php?tid=455305)



car define - SampzzonE - 01.08.2013

how can i define if is in the X car? if is not in X car he can't start mission?


Re: car define - Chrisis - 01.08.2013

you mean know if the player is in a car ? well use IsPlayerInAnyVehicle


Re: car define - Bakr - 01.08.2013

When creating that specific vehicle, assign the ID to a variable. When the player does whatever he does to trigger the mission, check if the ID of his current vehicle (GetPlayerVehicleID) matches that in the variable.
pawn Код:
new g_Car;
// OnGameModeInit
g_Car = CreateVehicle(...);
// Trigger mission
if(GetPlayerVehicleID(playerid) == g_Car)
{
    // they are in the car
}



Re: car define - SampzzonE - 01.08.2013

thanks


Re: car define - RajatPawar - 01.08.2013

No. Do you mean a particular VEHICLE MODEL or vehicle ID? What Bakr gave is used for a specific VEHICLE ID.

For a specific vehicle ID (Example - ID 0 - First created vehicle on the server)
pawn Код:
new g_Car;
// OnGameModeInit
g_Car = CreateVehicle(...);
// Trigger mission
if(GetPlayerVehicleID(playerid) == g_Car)
{
    // they are in the car
}
To check if they are in a SPECIFIC VEHICLE (Example - Infernus)
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 411)
{
        // they are in a infernus
}