warning Not Translated
This page has not been translated into the language that your browser requested yet. The English content is being shown as a fallback.
If you want to contribute a translation for this page then please click here.
IsPlayerInVehicle
Description
Checks if a player is in a specific vehicle.
Name | Description |
---|---|
playerid | ID of the player. |
vehicleid | ID of the vehicle. Note: NOT the modelid! |
Returns
true - Player IS in the vehicle.
false - Player is NOT in the vehicle.
Examples
new gSpecialCar;
public OnGameModeInit()
{
gSpecialCar = AddStaticVehicle(411, 0.0, 0.0, 5.0, 0.0, -1, -1);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/gSpecialCar", true) == 0)
{
if (IsPlayerInVehicle(playerid, gSpecialCar))
{
SendClientMessage(playerid, -1, "You're in the special car!");
}
return 1;
}
return 0;
}
Related Functions
- IsPlayerInAnyVehicle: Check if a player is in any vehicle.
- GetPlayerVehicleSeat: Check what seat a player is in.