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

NPC_GetAll

எச்சரிக்கை

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

Description​

Gets all NPC IDs and stores them in an array.

NameDescription
npcs[]Array to store the NPC IDs, passed by reference.
sizeSize of the array.

Returns​

Returns the number of NPCs found.

Examples​

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp(cmdtext, "/countnpcs", true))
{
new npcs[MAX_NPCS];
new count = NPC_GetAll(npcs);

SendClientMessage(playerid, 0x00FF00FF, "There are %d NPCs on the server.", count);

return 1;
}
return 0;
}

Notes​

குறிப்பு
  • The array must be large enough to hold all NPC IDs.
  • Only valid NPCs are included in the array.
  • The function returns the actual number of NPCs found.
உதவிக்குறிப்பு

Use this to iterate through all NPCs on the server.