IsPlayerInVehicle
From SA-MP Wiki
Description:
Checks if a player is in a specific vehicle.
(playerid, vehicleid)
playerid | ID of the player. |
vehicleid | ID of the vehicle. Note: NOT the modelid! |
Return Values:
- 1 - Player IS in the vehicle.
- 0 - Player is NOT in the vehicle.
Example Usage:
new specialcar; public OnGameModeInit() { specialcar = AddStaticVehicle(411, 0.0, 0.0, 5.0, 0.0, -1, -1); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmdtext, "/specialcar", true) == 0) { if(IsPlayerInVehicle(playerid, specialcar)) { SendClientMessage(playerid, -1, "You're in the special car!"); } return 1; } return 0; }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- IsPlayerInAnyVehicle: Check if a player is in any vehicle.
- GetPlayerVehicleSeat: Check what seat a player is in.