Pular para o conteúdo principal

NPC_GetWeaponState

aviso

Esta função foi adicionada no omp v1.5.8.3079 e não funcionará em versões anteriores!

Descrição

Obtém o estado da arma de um NPC.

NomeDescrição
npcidO ID do NPC

Retornos

Retorna o estado da arma ID.

Exemplos

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;
}

Notas

  • Os estados da arma incluem recarregar, disparar, ficar sem munição, etc.
  • Use isto para verificar o status atual da arma do NPC
  • Os valores de estado correspondem às constantes PlayerWeaponState

Funções Relacionadas

Callbacks Relacionadas