23.03.2016, 08:41
Hooked foreach iterator for FCNPC...probably useless for most of the people...
Please note that MAX_PLAYERS must be actual number of server slots (FCNPC connects NPC's backwards), or replace MAX_PLAYERS macro below...
Usage...
Now after posting these i can rightfully feel like a noob
Please note that MAX_PLAYERS must be actual number of server slots (FCNPC connects NPC's backwards), or replace MAX_PLAYERS macro below...
pawn Код:
new Iterator:FCNPC<MAX_PLAYERS>;
stock FCNPC_CreateHook(name[])
{
new npcid = FCNPC_Create(name);
if(npcid == INVALID_PLAYER_ID) return INVALID_PLAYER_ID;
Iter_Add(FCNPC, npcid);
return npcid;
}
stock FCNPC_DestroyHook(npcid)
{
if(!FCNPC_Destroy(npcid)) return 0;
Iter_Remove(FCNPC, npcid);
return 1;
}
#define FCNPC_Create FCNPC_CreateHook
#define FCNPC_Destroy FCNPC_DestroyHook
pawn Код:
foreach(new npcid : FCNPC
{
//Do your shit...
}
![Cheesy](images/smilies/biggrin.png)