26.11.2016, 18:03
PHP код:
fp SpawnarZumbi(id, data)
{
if(data == 1) return IsDeadNPC{id} = false;
static
Float:nx, Float:px,
Float:ny, Float:py,
Float:nz, Float:pz,
bool:locked, proxs ;
locked = true;
while(locked) {
GetVectorPath(gSpawns, MRandom(MAX_SPAWNS), nx, ny, nz);
proxs = 0;
for (new i = 0; i < vector_size(gPlayersOnline) ; i++) {
GetPlayerPos(vector_get(gPlayersOnline, i), px,py,pz);
if(distance(px, py, pz, nx, ny, nz) <= 150.0) {
proxs++;
break;
}
}
if(!proxs) {
locked = false;
break;
}
}
npc.SetPos(id, nx, ny, nz + 1.0);
SetTimerEx("SpawnarZumbi", 8000, false, "di", id,1);
return 1;
}