NPC Leaves my server - 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: NPC Leaves my server (
/showthread.php?tid=343020)
NPC Leaves my server -
Richie© - 15.05.2012
My NPC leaves my server and i dont know why
This is after about 3 hours of uptime.
pawn Code:
[15/05 - 20:16:46] [part] mara98 has left the server (6:1)
[15/05 - 20:47:24] [npc:part] Peter_Sausage has left the server (0:0)
[15/05 - 20:47:24] [npc:part] Hotdog_Guy has left the server (1:0)
[15/05 - 20:47:24] [npc:part] Travel_Guy has left the server (2:0)
[15/05 - 20:47:24] [npc:part] Train_Guy has left the server (3:0)
[15/05 - 20:47:24] [npc:part] Drug_Guy has left the server (4:0)
[15/05 - 20:47:24] [npc:part] Homer_Hotdog has left the server (5:0)
[15/05 - 21:38:47] Incoming connection: xxx.xxx.xxx:4246
They stayed connected fine in 0.3d and 0.3e RC5, but on final release they leave.
Re: NPC Leaves my server -
kaisersouse - 15.05.2012
Maybe they're like 90% of the samp playerbase and only play on servers w/ people already on them.
Sorry I know thats no help. We'd probably have to see some of your bot code to help more.
Re: NPC Leaves my server -
Richie© - 16.05.2012
Nobody else had problems with NPCs since 0.3e?
I dont belive anything is wrong with code, they worked fine in 3e RC5 like i wrote. Only thing i did was update sa-mp on vps and recompile with new includes.
Btw, can i reconnect my NPC if i let my script recognize npc andname on disconnect?
Re: NPC Leaves my server -
TzAkS. - 16.05.2012
Not sure if is working,not tested but try it.
pawn Code:
if (IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
if(!strcmp(npcname, "Name", true))// Your npc name here
{
ConnectNPC("NPC","NPC");//conect the npc founded with "Name"
}
if(!strcmp(npcname, "Name2", true))// Your second npc here
{
// codes
}
}
Put it to OnPlayerDisconect so will be called just if the npc leaves the game.