PDA

View Full Version : Need help with FCNPC


valerastar
04/05/2016, 08:45 PM
Hi all, i use the latest version of FCNPC plugin.
In server.cfg i have:
maxplayers 1000
maxnpc 300

In my script:LaunchZombies(){
for(new i; i<MAX_ZOMBIES; i++){
new Float:x,Float:y,Float:z,str[4];
new bool:temp=true;
while(temp){
x=random(3000)*-1;
if((x>=SFminX) && (x<=SFmaxX)){ temp=false;}
}
temp=true;
while(temp){
switch(random(2)){
case 0: y=random(1500);
case 1: y=random(1500)*-1;}
if((y>=SFminY) && (y<=SFmaxY)){ temp=false;}
}
MapAndreas_FindZ_For2DCoord(x, y, z);
format(str,sizeof(str),"Z%i",i);
zombies[i]= FCNPC_Create(str);
switch(random(6)){
case 0:FCNPC_Spawn(zombies[i],134,x,y,z);
case 1:FCNPC_Spawn(zombies[i],162,x,y,z);
case 2:FCNPC_Spawn(zombies[i],159,x,y,z);
case 3:FCNPC_Spawn(zombies[i],200,x,y,z);
case 4:FCNPC_Spawn(zombies[i],239,x,y,z);
case 5:FCNPC_Spawn(zombies[i],262,x,y,z);}
FCNPC_SetInvulnerable(zombies[i], false);
FCNPC_SetHealth(zombies[i], 1000.0);
SetPlayerColor(zombies[i],0xFFFFFFFF);
zombiessleep[i]=random(60);
zombiesview[i]=START_ZOMBIE_VIEW;
zombiestarget[i]=-1;
printf("*Zombie ID: %i Succesfully spawned.*",i);
}

Define MAX_ZOMBIES is set to 200. And, lets start the server.

Server prints me my message "Zombie ID: 1,2... Succesfully spawned." and [npc:join] npc..bla-bla-bla.

BUT, when we have 90 NPCs spawned, it stops spawning NPCs and just show me in console my messages. And also, in SA:MP Browser, server slots become not 800, but 910. Question: where is dat stupid limit for NPCs?! I need, 200 NPCs (in server.cfg limit is set to 300).

Help please :)

valerastar
05/05/2016, 07:54 AM
Freaking awesome! The problem was in STR[4]!!!!! YEES, in this!
Why? When i goed below 99, it is 100 and has 3 characters. So, Z100 is 4 characters, and its needed to be a string with legth of 5. I spent a day to detect this problem :D
Maybe, i helped someone with same problem, and, be carefull people :D