முதன்மை உள்ளடக்கத்துக்குச் செல்லவும்

NPC_EnableInfiniteAmmo

எச்சரிக்கை

செயல்பாடு என்பது omp v1.5.8.3079 பதிப்பில் சேர்க்கப்பட்டது. இது முந்தைய பதிப்புகளில் இயங்காது!

Description​

Enables or disables infinite ammo for an NPC.

NameDescription
npcidThe ID of the NPC
enabletrue to enable infinite ammo, false to disable

Returns​

Returns true if the operation was successful, false otherwise.

Examples​

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/toggleinfiniteammo", true))
{
new npcid = PlayerNPC[playerid];
if (npcid == INVALID_NPC_ID)
return SendClientMessage(playerid, 0xFF0000FF, "You are not debugging a NPC.");

new bool:infinite = NPC_IsInfiniteAmmoEnabled(npcid);
NPC_EnableInfiniteAmmo(npcid, !infinite);
SendClientMessage(playerid, 0x00FF00FF, "NPC %d infinite ammo: %s", npcid, !infinite ? "Enabled" : "Disabled");

return 1;
}
return 0;
}

Notes​

  • When enabled, the NPC will never run out of ammunition
  • This affects all weapons the NPC uses
  • The ammo count display may still decrease but weapon functionality remains