NPC_GetVehicleGearState
cảnh báo
Đã thêm hàm trong phiên bản omp v1.1.0.2612. Mục này không hoạt động trên các phiên bản cũ hơn!
Description
Gets the landing gear state of an NPC's aircraft.
| Name | Description |
|---|---|
| npcid | The 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
Related Functions
- NPC_SetVehicleGearState: Set aircraft landing gear state
- GetPlayerLandingGearState: Get player's landing gear state
- GetVehicleLandingGearState: Get vehicle's landing gear state
- NPC_GetVehicle: Get NPC's current vehicle
Related Resources
Related Callbacks
No specific callbacks are triggered by this function.