16.08.2017, 17:02
Tried this and it exceeds heap size:
PHP код:
timer ZombieRespawnTimer[5000]()
{
new Float:x,Float:y,Float:z, count_zombies, NPCSS[MAX_PLAYERS][MAX_PLAYERS], NPCSSID[MAX_PLAYERS][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))
{
NPCSS[i][k] ++;
NPCSSID[i][k] = k;
}
}
}
}
for(new i=0; i<MAX_PLAYERS; i++)
{
for(new k=0; k<MAX_PLAYERS; k++)
{
if(NPCSS[i][k] > 20)
{
printf("Found %d more zombies in a area, respawning...",NPCSS[i][k]-20);
FCNPC_Respawn(NPCSSID[i][k]);
}
}
}
}