IsPlayerInVehicle

Description

Checks if a player is in a specific vehicle.

NameDescription
playeridID of the player.
vehicleidID of the vehicle. Note: NOT the modelid!

Returns

1 - Player IS in the vehicle.

0 - 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