Npc doent join
#1

Guys i have a problem. I have a npc but when it join on the server after a while it disconnect. I have register/login system and i put the "if(IsPlayerNPC(playerid)) return 1;" on connect,spawn,requestcalss etc and also i have the line on the maxnpc 1 but still doent stay on the server. Pls help me. Thanks
Reply
#2

Could you show your script?
Reply
#3

I cant because the script its not mine and i dont have the permission. Do you have any idea for why thats happening?
Reply
#4

Ermm. Bad script?
Reply
#5

We cannot help you without looking at the script.
Reply
#6

Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
	if(!IsPlayerNPC(playerid))
	{
        if(IsPlayerNPC(playerid)) return 1;
		new name[MAX_PLAYER_NAME], string[256];
    	GetPlayerName(playerid, name, sizeof(name));
    	format(string, sizeof(string), "** %s (%d) Has Joined The Server", name,playerid);
		/*some code*/
		if(!udb_Exists(PlayerName2(playerid)))
		{
            if(IsPlayerNPC(playerid)) return 1;
			ShowPlayerDialog(playerid, Register, DIALOG_STYLE_INPUT, "Please Register", "This account is not registered \nType a password below (don't forget it)", "Register", "Cancel");
		}
		if(udb_Exists(PlayerName2(playerid)))
		{
            if(IsPlayerNPC(playerid)) return 1;
			ShowPlayerDialog(playerid, Logged, DIALOG_STYLE_INPUT, "Please Login", "This account is registered \nType you password below", "Login", "Cancel");
		}
    	SetTimerEx("SettingPlayerTeam",10,1,"i",playerid);
    	playerCheckpoint[playerid] = 999;
   		PLAYERLIST_authed[playerid]=false;
	}
	else
	{
		if(IsPlayerNPC(playerid)) return 1;
		new name[MAX_PLAYER_NAME], string[256];
    	GetPlayerName(playerid, name, sizeof(name));
    	format(string, sizeof(string), "** %s (%d) Has Joined The Server", name,playerid);
		SendClientMessageToAll(COLOUR_GREY,string);
		
	}
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	gPlayerClass[playerid] = classid;
	PlayerInfo[playerid][Spawned] = 0;
	if(IsPlayerNPC(playerid)) return 1;
    if(StartingNewLife(playerid))
	{
        if(IsPlayerNPC(playerid)) return 1;
		SetupPlayerForClassSelection(playerid);
	}
	else
	if(!StartingNewLife(playerid))
	{
        if(IsPlayerNPC(playerid)) return 1;
		SetPlayerSkin(playerid,dUserINT(PlayerName2(playerid)).("Skin"));
	}
	return 1;
}

public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) 
	{
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname)); 
	    if(!strcmp(npcname, "[BOT]PoliceOfficer1", true))
		{
            SetPlayerColor(playerid,COLOUR_BLUE);
            SetPlayerSkin(playerid, 267);
	    }
		return 1;
    }
    else
    {
		SetPlayerColor(playerid,COLOUR_WHITE);
    	PlayerInfo[playerid][Spawned] = 1;
    	if(!IsPlayerNPC(playerid))
		{
			if(StartingNewLife(playerid))
			{
			    SendClientMessage(playerid,COLOUR_GREEN,"You Have Started A New Life! You Can Quit And Come Back Later To Continue This Life");
				/*some code*/
			}
			else
			if(!StartingNewLife(playerid))
			{
			    SendClientMessage(playerid,COLOUR_GREEN,"Data Loaded - Continuing Current Life...");
                            /*some code*/
 			}
		}
	}
	return 1;
}
I hope this will is enough. Thankd for try to help me
Reply
#7

bump!!!!!!!!
Reply
#8

bump!!!!!!!! !!!
Reply
#9

Check your server.cfg, change thet value of MAX_NPCS.
Reply
#10

Quote:
Originally Posted by Retardedwolf
Посмотреть сообщение
Check your server.cfg, change thet value of MAX_NPCS.
Quote:

Guys i have a problem. I have a npc but when it join on the server after a while it disconnect. I have register/login system and i put the "if(IsPlayerNPC(playerid)) return 1;" on connect,spawn,requestcalss etc and also i have the line on the maxnpc 1 but still doent stay on the server. Pls help me. Thanks

Try to let them connect without scripts, and with the standard gamemode.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)