SA-MP Forums Archive
Problem with NPCs/BOTs - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with NPCs/BOTs (/showthread.php?tid=208752)



Problem with NPCs/BOTs - donB - 09.01.2011

Hey,
I've scripted the bots. Th problem now is that those bots ON FOOT are leaving the server as soon as they join, and the ON VEHICLE bots are fine.

Reason shown: Connection Reset

Please help.


Re: Problem with NPCs/BOTs - Mr.Stranger - 09.01.2011

give us your OnPlayerConnect code


Re: Problem with NPCs/BOTs - donB - 09.01.2011

Код:
public OnPlayerConnect(playerid)
{

    new plrIP[16]; // The varyable
    GetPlayerIp(playerid, plrIP, sizeof(plrIP)); // I am getting their IP and storing it.

	new stringg[156];
 	new namee[30];
    GetPlayerName(playerid,namee,30);
	format(stringg,sizeof(stringg),"~g~Connect: ~y~%s~b~ [%d]",namee,playerid);
    AddConnection(stringg);
    
    PlayerIP[playerid] = plrIP;
	
	if(!IsPlayerNPC(playerid))
	{
	    new name[30];
	    GetPlayerName(playerid,name,30);
	    if(!strcmp(name,"[BOT]Tension",true) || !strcmp(name,"[BOT]Major",true) || !strcmp(name,"Vacant_House",true) || !strcmp(name,"Vacant_Business",true) || !strcmp(name,"[BOT]Osama",true) || !strcmp(name,"[BOT]Charlie",true) || !strcmp(name,"[BOT]Buzz",true) || !strcmp(name,"[BOT]Del_Trotter",true))
	    {
	        SendClientMessage(playerid,COLOR_RED,"This name is reserved! Change your name!");
			Kick(playerid);
		}
	}
	else
	if(IsPlayerNPC(playerid)) return SpawnPlayer(playerid);