IsPlayerInVehicle

From SA-MP Wiki

(Redirected from Function:IsPlayerInVehicle)
Jump to: navigation, search


Description:

Checks if a player is in a specific vehicle.


Parameters:
(playerid, vehicleid)
playeridID of the player.
vehicleidID 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.

Personal tools
Navigation
Toolbox
In other languages