NPC_GetWeaponSkillLevel
cảnh báo
Đã thêm hàm trong phiên bản omp v1.5.8.3079. Mục này không hoạt động trên các phiên bản cũ hơn!
Description
Gets the weapon skill level of an NPC.
| Name | Description |
|---|---|
| npcid | The ID of the NPC |
| skill | The weapon skill type (WEAPONSKILL) |
Returns
Returns the weapon skill level (0-999), or UNKNOWN_WEAPONSKILL on failure.
Examples
public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/checkweaponskill", 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 pistol = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_PISTOL);
new silenced = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_PISTOL_SILENCED);
new deagle = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_DESERT_EAGLE);
new shotgun = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_SHOTGUN);
new micro = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_MICRO_UZI);
new mp5 = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_MP5);
new ak47 = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_AK47);
new m4 = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_M4);
new sniper = NPC_GetWeaponSkillLevel(npcid, WEAPONSKILL_SNIPERRIFLE);
SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon skills:", npcid);
SendClientMessage(playerid, 0xFFFFFFFF, "Pistol:%d Silenced:%d Deagle:%d Shotgun:%d", pistol, silenced, deagle, shotgun);
SendClientMessage(playerid, 0xFFFFFFFF, "Micro:%d MP5:%d AK47:%d M4:%d Sniper:%d", micro, mp5, ak47, m4, sniper);
return 1;
}
return 0;
}
Notes
- Weapon skill affects accuracy and shooting behavior
- Skill level ranges from 0 (poor) to 999 (hitman)
- Returns
UNKNOWN_WEAPONSKILLif the NPC is invalid or skill type is invalid
Related Functions
- NPC_SetWeaponSkillLevel: Set NPC weapon skill level
- NPC_GetWeaponAccuracy: Get weapon accuracy
- NPC_SetWeaponAccuracy: Set weapon accuracy
- NPC_GetWeapon: Get NPC weapon
Related Callbacks
- OnNPCWeaponShot: Called when NPC fires weapon