GetPlayerVehicleID
Description:
Function GetPlayerVehicleID gets the ID of the vehicle the player is currently in.
NOT the model id of the vehicle. See GetVehicleModel for that. |
Parameters:
(playerid)
int | playerid | The ID of the player in the vehicle that you want to get the ID of. |
Return Values:
ID of the vehicle or 0 if not in a vehicle
Examples:
//add 10x Nitro if the player is in a car. Might be called on a command. new vehicle; vehicle = GetPlayerVehicleID(playerid); if(vehicle > 0) { AddVehicleComponent(vehicle, 1010); }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- IsPlayerInVehicle: Check if a player is in a certain vehicle.
- IsPlayerInAnyVehicle: Check if a player is in any vehicle.
- GetPlayerVehicleSeat: Check what seat a player is in.
- GetVehicleModel: Get the model id of a vehicle.