Pular para o conteúdo principal

NPC_GetWeaponState

atenção

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

Description

Gets the weapon state of an NPC.

NameDescription
npcidThe ID of the NPC

Returns

Returns the weapon state ID.

Examples

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/checkweaponstate", 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.");

new WEAPONSTATE:state = WEAPONSTATE:NPC_GetWeaponState(npcid);

static weaponStates[5][64] =
{
"Unknown",
"No ammo remaining",
"Single bullet left",
"More than one bullet left",
"Reloading"
};

SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon state: %s (%d)", npcid, weaponStates[state], _:state);
return 1;
}
return 0;
}

Notes

  • Weapon states include reloading, shooting, out of ammo, etc.
  • Use this to check the current status of the NPC's weapon
  • State values correspond to PlayerWeaponState constants