Zum Hauptinhalt springen

NPC_SetWeaponClipSize

warnung

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

Description​

Sets the clip size for an NPC's current weapon.

NameDescription
npcidThe ID of the NPC
weaponThe weapon ID to set
sizeThe new clip size

Returns​

Returns true if the operation was successful, false otherwise.

Examples​

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/setweaponclipsize ", true, 19))
{
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 weapon = NPC_GetWeapon(npcid);
new clipsize = strval(cmdtext[19]);

NPC_SetWeaponClipSize(npcid, WEAPON:weapon, clipsize);
SendClientMessage(playerid, 0x00FF00FF, "NPC %d weapon %d clip size set to %d", npcid, weapon, clipsize);
return 1;
}
return 0;
}

Notes​

  • The NPC must have a weapon for this function to work
  • Clip size affects how much ammo the NPC can fire before needing to reload
  • Different weapons have different default clip sizes