Need help with FCNPC - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need help with FCNPC (
/showthread.php?tid=606467)
Need help with FCNPC -
valerastar - 04.05.2016
Hi all, i use the latest version of FCNPC plugin.
In server.cfg i have:
maxplayers 1000
maxnpc 300
In my script:
PHP код:
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
Re: Need help with FCNPC -
valerastar - 05.05.2016
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

Maybe, i helped someone with same problem, and, be carefull people