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.

IsPlayerInAnyVehicle

Description

Check if a player is inside any vehicle (as a driver or passenger).

NameDescription
playeridThe ID of the player to check.

Returns

1: The player is in a vehicle.

0: The player is not in a vehicle.

Examples

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp(cmdtext, "/invehicle", true) == 0)
    {
        if (IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessage(playerid, 0x00FF00AA, "You're in a vehicle.");
        }
        return 1;
    }
    return 0;
}

Related Functions

  • IsPlayerInVehicle: Check if a player is in a certain vehicle.
  • GetPlayerVehicleSeat: Check what seat a player is in.

Community

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

More

  • SA-MP
  • Blog
  • GitHub