The open.mp logo
Home
FAQ
Forums
Servers
Partners
Docs
Blog

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.

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

  • IsPlayerInAnyVehicle: Check if a player is in any vehicle.
  • GetPlayerVehicleSeat: Check what seat a player is in.

Community

  • Discord
  • Instagram
  • Twitter
  • Twitch
  • YouTube
  • Facebook
  • VK

More

  • SA-MP
  • Blog
  • GitHub