NPC Connection Problem
#1

Hello there,

I have some issue with connecting NPC on my server, I made timer that every 3 seconds add NPC, but from some reason it only adds one NPC, for every other NPC log just print incoming connection: 127.0.0.1:PORT.

Does any one know what could that be
Reply
#2

What is 'maxnpc' set to in server.cfg? (Type it in the console if you have it open)
Reply
#3

maxplayers 500 maxnpc 40, its all ok, its grandlarc script, in onplayerconnect, onplayerreqestspawn, onplayerspawn i put if(IsPlayerNPC(playerid)) return true;
Reply
#4

Do the .amx files exist in the npcmodes directory? Are you referencing them correctly? They may be case sensitive also.
Reply
#5

I tried 2 methods.


1st method
pawn Код:
new name[16];
for(new i=0;i<40;i++){
    format(name, sizeof(name), "NPC %d", i);
    ConnectNPC(name, "npcidle");
}
2nd method
pawn Код:
new name[16], script[16];
for(new i=0;i<40;i++){
    format(name, sizeof(name), "NPC %d", i);
    format(script, sizeof(script), "script_%d", i);
    ConnectNPC(name, script);
}
and I made 42 script_1, scirpt_2.... script_42
Reply
#6

Well there's your problem! You can't have spaces in names!

Also, may I ask why on earth you have 40 npc files?! If they all do the same thing you can just use one again and again. The only thing that has to be different is the names.
Reply
#7

You may ask, I thought maybe it can't load same files for every npc, and that's why I made 40 of them , but if I may not have space, how does first NPC connects and spawns?

EDIT:

pawn Код:
public AddNPC(slot){
    if(slot == 42) return true;
    new name[24];
    format(name, sizeof(name), "NPC%d", slot);
    ConnectNPC(name, "npcidle");
    slot++;
    SetTimerEx("AddNPC", 3000, false, "d", slot);
    return true;
}
still just adding one NPC
Reply
#8

The first NPC connected with a space in it's name..?

I highly doubt that NPCs are exempt from the name restrictions.

(Signing off, won't reply).
Reply
#9

here is part of log

Код:
[19:41:02] Incoming connection: 127.0.0.1:34873
[19:41:03] [npc:join] NPC has joined the server (0:127.0.0.1)
[19:41:06] Incoming connection: 127.0.0.1:54155
[19:41:09] Incoming connection: 127.0.0.1:59927
[19:41:12] Incoming connection: 127.0.0.1:56404
[19:41:15] Incoming connection: 127.0.0.1:42954
[19:41:18] Incoming connection: 127.0.0.1:41639
[19:41:22] Incoming connection: 127.0.0.1:55368
[19:41:25] Incoming connection: 127.0.0.1:49009
[19:41:28] Incoming connection: 127.0.0.1:41048
[19:41:31] Incoming connection: 127.0.0.1:45415
[19:41:35] Incoming connection: 127.0.0.1:54703
[19:41:38] Incoming connection: 127.0.0.1:38722
[19:41:41] Incoming connection: 127.0.0.1:36871
[19:41:44] Incoming connection: 127.0.0.1:49656
[19:41:47] Incoming connection: 127.0.0.1:36790
[19:41:51] Incoming connection: 127.0.0.1:57711
[19:41:54] Incoming connection: 127.0.0.1:54304
[19:41:57] Incoming connection: 127.0.0.1:57705
[19:42:00] Incoming connection: 127.0.0.1:35667
[19:42:04] Incoming connection: 127.0.0.1:42582
[19:42:07] Incoming connection: 127.0.0.1:36413
[19:42:10] Incoming connection: 127.0.0.1:43391
[19:42:13] Incoming connection: 127.0.0.1:45283
[19:42:16] Incoming connection: 127.0.0.1:36241
[19:42:20] Incoming connection: 127.0.0.1:45260
[19:42:23] Incoming connection: 127.0.0.1:33381
[19:42:26] Incoming connection: 127.0.0.1:54339
[19:42:29] Incoming connection: 127.0.0.1:49381
[19:42:33] Incoming connection: 127.0.0.1:38654
[19:42:36] Incoming connection: 127.0.0.1:35542
[19:42:39] Incoming connection: 127.0.0.1:45245
[19:42:42] Incoming connection: 127.0.0.1:56222
[19:42:45] Incoming connection: 127.0.0.1:33793
[19:42:49] Incoming connection: 127.0.0.1:46512
[19:42:52] Incoming connection: 127.0.0.1:44118
[19:42:55] Incoming connection: 127.0.0.1:52815
[19:42:58] Incoming connection: 127.0.0.1:51186
[19:43:02] Incoming connection: 127.0.0.1:47611
[19:43:05] Incoming connection: 127.0.0.1:55379
[19:43:08] Incoming connection: 127.0.0.1:47405
[19:43:11] Incoming connection: 127.0.0.1:33563
and there is no space in name, NPC1, NPC2...NPCxx

EDIT:

I figure it out that name of npc is not NPC1 but NPC, and if it doesn't work its obvious why it doesn't spawn other npcs
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)