Preskoči na vsebino

NPC_GetVehicleGearState

opozorilo

This function was added in omp v1.1.0.2612 and will not work in earlier versions!

Description​

Gets the landing gear state of an NPC's aircraft.

NameDescription
npcidThe ID of the NPC

Returns​

Returns the landing gear state of the NPC's aircraft (LANDING_GEAR_STATE_DOWN or LANDING_GEAR_STATE_UP).

Examples​

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/checkvehiclegearstate", true))
{
new npcid = PlayerNPC[playerid];
if (npcid == INVALID_NPC_ID)
return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC.");

if (!NPC_IsValid(npcid))
return SendClientMessage(playerid, 0xFF0000FF, "Invalid NPC.");

if (NPC_GetVehicle(npcid) == INVALID_VEHICLE_ID)
return SendClientMessage(playerid, 0xFFFF00FF, "NPC %d is not in any vehicle.", npcid);

new LANDING_GEAR_STATE:gearState = NPC_GetVehicleGearState(npcid);

if (gearState == LANDING_GEAR_STATE_UP)
SendClientMessage(playerid, 0x00FF00FF, "NPC %d: Landing gear UP", npcid);
else
SendClientMessage(playerid, 0x00FF00FF, "NPC %d: Landing gear DOWN", npcid);

return 1;
}
return 0;
}

Notes​

  • Only works when the NPC is piloting an aircraft
  • Returns the current landing gear state set by NPC_SetVehicleGearState
  • Uses the same constants as Vehicle Landing Gear States: LANDING_GEAR_STATE_DOWN and LANDING_GEAR_STATE_UP
  • This is the NPC equivalent of GetPlayerLandingGearState

No specific callbacks are triggered by this function.