跳到主要内容

NPC_SetWeaponClipSize

注意

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

描述

设置 NPC 当前武器的弹匣容量。

参数说明
npcidNPC 的 ID
weapon要设置的武器 ID
size新的弹匣容量

返回值

如果操作成功则返回true,否则返回false

示例

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

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

new weapon = NPC_GetWeapon(npcid);
new clipsize = strval(cmdtext[19]);

NPC_SetWeaponClipSize(npcid, WEAPON:weapon, clipsize);
SendClientMessage(playerid, 0x00FF00FF, "NPC %d 武器 %d 弹匣容量设置为 %d", npcid, weapon, clipsize);
return 1;
}
return 0;
}

注意事项

  • NPC 必须拥有武器此函数才能工作
  • 弹匣容量影响 NPC 在需要重新装填前可以发射多少弹药
  • 不同武器有不同的默认弹匣容量

相关函数

相关回调