16.08.2017, 16:50
PHP код:
timer ZombieRespawnTimer[5000]()
{
new bool:true_found, id, Float:x,Float:y,Float:z, count_zombies, NPCSS[MAX_PLAYERS];
count_zombies=0;
for(new i=0; i<MAX_PLAYERS; i++)
{
GetPlayerPos(i,x,y,z);
for(new k=0; k<MAX_PLAYERS; k++)
{
if(IsPlayerNPC(k))
{
if(IsPlayerInRangeOfPoint(k, 50, x, y, z))
{
true_found=true;
id = k;
}
}
}
if(true_found)
{
count_zombies++;
NPCSS[count_zombies] = id;
}
}
if(count_zombies > 20)
{
printf("Found %d more zombies in a area, respawning...",count_zombies-20);
for(new i=0; i<count_zombies-20; i++)
{
FCNPC_Respawn(NPCSS[i]);
}
}
}
I am using double loop as i want to check through every npc, and loop to all other npc's, but the problem is the server kinda hangs when the timer gets called and i also know the reason... I was here to ask if someone has a better idea?