跳到主要内容

NPC_SetVehicleGearState

注意

这个函数是在omp v1.1.0.2612中添加的,在以前的版本中不起作用!

描述

设置 NPC 驾驶飞机时的起落架状态。

参数说明
npcidNPC 的 ID
gearstate要设置的起落架状态(LANDING_GEAR_STATE_DOWN 或 LANDING_GEAR_STATE_UP)

返回值

此函数不返回特定值。

示例

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/setvehiclegearstate ", true, 21))
{
new npcid = PlayerNPC[playerid];
if (npcid == INVALID_NPC_ID)
return SendClientMessage(playerid, 0xFF0000FF, "你没有在调试NPC。");

if (!NPC_IsValid(npcid))
return SendClientMessage(playerid, 0xFF0000FF, "无效的NPC。");

new gearState = strval(cmdtext[21]);

NPC_SetVehicleGearState(npcid, gearState);
SendClientMessage(playerid, 0x00FF00FF, "NPC %d 飞机起落架状态设置为 %d", npcid, gearState);

return 1;
}
return 0;
}

注意事项

  • 仅在 NPC 驾驶飞机时有效
  • 使用与飞机起落架状态相同的常量:LANDING_GEAR_STATE_DOWN 和 LANDING_GEAR_STATE_UP
  • 使用 NPC_GetVehicleGearState 检查当前起落架状态

相关函数

相关资源

相关回调

此函数不会触发任何特定的回调。