PDA

View Full Version : Went creating mission, failed due to inability to connect >20 NPCs


fiki574
27/01/2014, 06:42 PM
Hello.

Today, I decided to make a _ _ _ _ _ FS which would eventually get released here on SAMP forums, but I ran into a problem. I downloaded RNPC plugin and ARNPC include and went creating NPCs which are neccessary for this FS. Now, I need >20 NPCs (18 atm, to be exact) to connect in order to create somewhere playable mission. BUT, even though log says they connect/spawn, only 2 NPCs actually get spawned. What is the problem?


public OnFilterScriptInit()
{
AddStaticVehicle(598,2039.6495,996.6635,10.3316,30 .7603,33,33); // polcar1
AddStaticVehicle(598,2039.8739,1021.8156,10.3316,1 56.7971,33,33); // polcar2
AddStaticVehicle(598,2040.9565,1012.0996,10.4719,1 40.1337,0,0); // polcar3
AddStaticVehicle(598,2039.6195,988.6314,10.4177,29 .7037,0,0); // polcar4
AddStaticVehicle(427,2057.3894,973.9127,10.1889,0. 5516,33,33); // swatcar1
AddStaticVehicle(427,2044.4695,1038.7253,10.3300,1 76.4604,33,33); // swatcar2
AddStaticVehicle(427,2048.2524,957.0079,9.8703,273 .6715,33,33); // swatcar3

NPC1 = CreateRNPC("Cop 1");
SetRNPCSkin(NPC1, 265);
SetRNPCPos(NPC1, 2043.9784,991.6365,10.6719);
SetRNPCFacingAngle(NPC1, 60.2700);

NPC2 = CreateRNPC("Cop 2");
SetRNPCSkin(NPC2, 266);
SetRNPCPos(NPC2, 2043.7156,997.5270,10.6719);
SetRNPCFacingAngle(NPC2, 62.1500);

NPC3 = CreateRNPC("Cop 3");
SetRNPCSkin(NPC3, 267);
SetRNPCPos(NPC3, 2043.7521,1013.2101,10.6719);
SetRNPCFacingAngle(NPC3, 102.8838);

NPC4 = CreateRNPC("Cop 4");
SetRNPCSkin(NPC4, 265);
SetRNPCPos(NPC4, 2041.7263,1010.2548,10.6719);
SetRNPCFacingAngle(NPC4, 102.8838);

NPC5 = CreateRNPC("Cop 5");
SetRNPCSkin(NPC5, 266);
SetRNPCPos(NPC5, 2043.4915,1026.3751,10.6719);
SetRNPCFacingAngle(NPC5, 138.2907);

NPC6 = CreateRNPC("Cop 6");
SetRNPCSkin(NPC6, 267);
SetRNPCPos(NPC6, 2040.5946,1031.6643,10.6719);
SetRNPCFacingAngle(NPC6, 154.2709);

NPC7 = CreateRNPC("SWAT 1");
SetRNPCSkin(NPC7, 285);
SetRNPCPos(NPC7, 2028.6028,991.5991,10.8203);
SetRNPCFacingAngle(NPC7, 22.8455);

NPC8 = CreateRNPC("SWAT 2");
SetRNPCSkin(NPC8, 285);
SetRNPCPos(NPC8, 2024.2234,990.4247,10.8203);
SetRNPCFacingAngle(NPC8, 9.6855);

NPC9 = CreateRNPC("SWAT 3");
SetRNPCSkin(NPC9, 285);
SetRNPCPos(NPC9, 2028.8922,1025.1443,10.8203);
SetRNPCFacingAngle(NPC9, 180.1404);

NPC10 = CreateRNPC("SWAT 4");
SetRNPCSkin(NPC10, 285);
SetRNPCPos(NPC10, 2028.8922,1025.1443,10.8203);
SetRNPCFacingAngle(NPC10, 165.1003);

NPC11 = CreateRNPC("SWAT 5");
SetRNPCSkin(NPC11, 285);
SetRNPCPos(NPC11, 2058.5010,970.3214,10.4639);
SetRNPCFacingAngle(NPC11, 62.5551);

NPC12 = CreateRNPC("SWAT 6");
SetRNPCSkin(NPC12, 285);
SetRNPCPos(NPC12, 2047.6262,1039.9038,10.6719);
SetRNPCFacingAngle(NPC12, 36.8615);

NPC13 = CreateRNPC("SWAT 7");
SetRNPCSkin(NPC13, 285);
SetRNPCPos(NPC13, 2050.5945,1030.2097,10.6719);
SetRNPCFacingAngle(NPC13, 149.3492);

NPC14 = CreateRNPC("SWAT 8");
SetRNPCSkin(NPC14, 285);
SetRNPCPos(NPC14, 2040.6152,961.4666,10.3177);
SetRNPCFacingAngle(NPC14, 134.6224);

NPC15 = CreateRNPC("SWAT 9");
SetRNPCSkin(NPC15, 285);
SetRNPCPos(NPC15, 2055.1809,959.7631,10.4000);
SetRNPCFacingAngle(NPC15, 21.2180);

NPC16 = CreateRNPC("SWAT 10");
SetRNPCSkin(NPC16, 285);
SetRNPCPos(NPC16, 2060.1340,986.4418,10.6719);
SetRNPCFacingAngle(NPC16, 29.0514);

NPC17 = CreateRNPC("Cop 7");
SetRNPCSkin(NPC17, 265);
SetRNPCPos(NPC17, 2043.7908,986.9569,10.6719);
SetRNPCFacingAngle(NPC17, 53.8339);

NPC18 = CreateRNPC("Cop 8");
SetRNPCSkin(NPC18, 266);
SetRNPCPos(NPC18, 2043.1403,989.7284,10.6719);
SetRNPCFacingAngle(NPC18,53.8339);
return 1;
}


I also get 'blocked ip due to attack'-like message, I do understand I'm r*ping connects from one IP, but still don't seem to realize why can't they properly spawn (NPCs, ofc)?

fiki574
29/01/2014, 01:35 PM
bump

jiwan
29/01/2014, 01:37 PM
EDIT: Wrong post sorry

boomerboom
29/01/2014, 01:51 PM
You can set checkpoint and whne he enters them you connect NPC or set timer

Nadam se da je pomoglo!

fiki574
29/01/2014, 01:58 PM
You can set checkpoint and whne he enters them you connect NPC or set timer

Nadam se da je pomoglo!

I tried splitting the connecting into 3 different timers, each called after 5 seconds, still does not work. :/

Wizz123
29/01/2014, 02:01 PM
Kalcor set protection against DoS did you write 'messageholelimit' in the server.cfg? maybe thats why they cant login

[WSF]ThA_Devil
29/01/2014, 02:03 PM
What's your maxnpc in server.cfg?
This forum requires that you wait 240 seconds between posts. Please try again in 6 seconds.
lol

fiki574
29/01/2014, 02:10 PM
Kalcor set protection against DoS did you write 'messageholelimit' in the server.cfg? maybe thats why they cant login

'Warning: client exceeded message hole limit ..."

ThA_Devil;2889676']What's your maxnpc in server.cfg?
This forum requires that you wait 240 seconds between posts. Please try again in 6 seconds.
lol

'maxnpc 50'

Wizz123
29/01/2014, 02:16 PM
Remove the messageholelimit from server.cfg

fiki574
29/01/2014, 04:42 PM
Remove the messageholelimit from server.cfg

Still aint working

Corekt
29/01/2014, 05:39 PM
Separate each CreateRNPC with a 1 second timer with a delay. Also try storing the spawn information in arrays since you're dealing with multiple NPCs and call them in OnPlayerSpawn.


#define MAX_BOTS 19

new gNPC[MAX_BOTS];

// Don't think you can have spaces in a bot name, so I replaced them with underscores.
new gNPCName[MAX_BOTS][] =
{
"Cop_1",
"Cop_2",
"Cop_3",
"Cop_5",
"Cop_6",
"SWAT_1",
"SWAT_2",
"SWAT_3",
"SWAT_4",
"SWAT_5",
"SWAT_6",
"SWAT_7",
"SWAT_8",
"SWAT_9",
"SWAT_10",
"Cop_7",
"Cop_8"
};

forward TimerConnectNPC(npcid);
public TimerConnectNPC(npcid)
{
gNPC[npcid] = CreateRNPC(gNPCName[npcid]);
}

public OnFilterScriptInit()
{
for (new i = 0; i < sizeof(gNPC); i++) {
SetTimerEx("TimerConnectNPC", (1000 * (i + 1)) + 2000, false, "d", i);
}
return 1;
}

fiki574
29/01/2014, 07:07 PM
Separate each CreateRNPC with a 1 second timer with a delay. Also try storing the spawn information in arrays since you're dealing with multiple NPCs and call them in OnPlayerSpawn.


#define MAX_BOTS 19

new gNPC[MAX_BOTS];

// Don't think you can have spaces in a bot name, so I replaced them with underscores.
new gNPCName[MAX_BOTS][] =
{
"Cop_1",
"Cop_2",
"Cop_3",
"Cop_5",
"Cop_6",
"SWAT_1",
"SWAT_2",
"SWAT_3",
"SWAT_4",
"SWAT_5",
"SWAT_6",
"SWAT_7",
"SWAT_8",
"SWAT_9",
"SWAT_10",
"Cop_7",
"Cop_8"
};

forward TimerConnectNPC(npcid);
public TimerConnectNPC(npcid)
{
gNPC[npcid] = CreateRNPC(gNPCName[npcid]);
}

public OnFilterScriptInit()
{
for (new i = 0; i < sizeof(gNPC); i++) {
SetTimerEx("TimerConnectNPC", (1000 * (i + 1)) + 2000, false, "d", i);
}
return 1;
}



Very nice, works now!

Thanks, +rep.