npc problem
#1

well this is my problem i made some npc but when i launch the sever in my consel this happens

16:53:27] [npc:join] TrainDriverLS has joined the server (0:127.0.0.1)
[16:53:27] [npcart] TrainDriverLS has left the server (0:2)
[16:53:27] [npc:join] TrainDriverLV has joined the server (1:127.0.0.1)
[16:53:27] [npcart] TrainDriverLV has left the server (1:2)
[16:53:27] [npc:join] PilotLV has joined the server (0:127.0.0.1)
[16:53:27] [npcart] PilotLV has left the server (0:2)
[16:53:27] [npc:join] TrainDriverSF has joined the server (1:127.0.0.1)
[16:53:27] [npcart] TrainDriverSF has left the server (1:2)
[16:53:27] [npc:join] PilotSF has joined the server (2:127.0.0.1)
[16:53:27] [npcart] PilotSF has left the server (2:2)
[16:53:27] [npc:join] PilotLS has joined the server (3:127.0.0.1)
[16:53:27] [npcart] PilotLS has left the server (3:2)
[16:56:03] --- Server Shutting Down.
how do i keep npc from leaving my server
Reply
#2

Do you allow players to spawn before logging in?
Reply
#3

no you need to login frist so how can i make them login .. cause its roleplay server.... so how can i change it for npc to login
Reply
#4

Add a check at the login part of your script using IsPlayerNPC, and don't run any of the login requirements if it's an NPC.
Reply
#5

hi i have same problem

my bot have rp name

I hve the fs of V№ceC№ty

server logs
Код:
[02:21:25] Incoming connection: 127.0.0.1:35171
[02:21:25] [npc:join] Taxib_Sum has joined the server (0:127.0.0.1)
[02:21:25] Incoming connection: 127.0.0.1:34115
[02:21:25] [npc:join] Taxic_Sum has joined the server (2:127.0.0.1)
[02:21:25] Incoming connection: 127.0.0.1:48052
[02:21:25] [npc:join] Taxia_Sum has joined the server (1:127.0.0.1)
[02:21:25] Incoming connection: 127.0.0.1:54895
[02:21:25] [npc:join] Taxid_Sum has joined the server (3:127.0.0.1)
[02:21:29] [npc:part] Taxib_Sum has left the server (0:2)
[02:21:29] [npc:part] Taxia_Sum has left the server (1:2)
[02:21:29] [npc:part] Taxic_Sum has left the server (2:2)
[02:21:29] [npc:part] Taxid_Sum has left the server (3:2)
Pawn Code
Код:
new Taxia_Sum;
new Taxib_Sum;
new Taxic_Sum;
new Taxid_Sum;

public OnGameModeInit()
{

	// NPCS
	ConnectNPC("Taxia_Sum","RPTaxi");
	ConnectNPC("Taxib_Sum","RPTaxi2");
	ConnectNPC("Taxic_Sum","RPTaxi3");
	ConnectNPC("Taxid_Sum","RPTaxi4");

	
	Taxia_Sum =	AddStaticVehicle(420,2044.8854,1473.2106,10.4494,181.3339,6,1); 
	Taxib_Sum =	AddStaticVehicle(420,2064.8854,1473.2106,10.4494,181.3339,6,1); 
	Taxic_Sum =	AddStaticVehicle(420,2084.8854,1473.2106,10.4494,181.3339,6,1); 
	Taxid_Sum =	AddStaticVehicle(420,2104.8854,1473.2106,10.4494,181.3339,6,1); 
	return 1;
}

public OnPlayerSpawn(playerid)
{
  if(!IsPlayerNPC(playerid)) return 0;

	new playername[64];
	GetPlayerName(playerid,playername,64);

 	if(!strcmp(playername,"Taxia_Sum",true)) {
    PutPlayerInVehicle(playerid, Taxia_Sum, 0);
    SetSpawnInfo( playerid, 0, 255, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
    ShowPlayerMarkers(0);
	}
	else if(!strcmp(playername,"Taxib_Sum",true)) {
		PutPlayerInVehicle(playerid, Taxib_Sum, 0);
		SetSpawnInfo( playerid, 0, 255, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
		ShowPlayerMarkers(0);
	}
	else if(!strcmp(playername,"Taxic_Sum",true)) {
	  PutPlayerInVehicle(playerid, Taxic_Sum, 0);
	  SetSpawnInfo( playerid, 0, 255, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
	  ShowPlayerMarkers(0);
	}
	else if(!strcmp(playername,"Taxid_Sum",true)) {
		PutPlayerInVehicle(playerid, Taxid_Sum, 0);
		SetSpawnInfo( playerid, 0, 255, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
		ShowPlayerMarkers(0);
	}
  return 1;
}
Therefore I them is well placed a rp name

rec file his property in place

have disactivated my kick to the ping

anticheat is disactivated

an idea?
Reply
#6

Код:
maxnpc 4
in your server.cfg file
Reply
#7

Quote:
Originally Posted by WESTre
Код:
maxnpc 4
in your server.cfg file
i have this line but npc crash
Reply
#8

like JaTochNietDan says you need to make the script think they are logged in.
Reply
#9

OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid))
{
SetSpawnInfo(....);
SpawnPlayer(....);
return 1;
}
}

Obviously, that was just a snippet.
Reply
#10

Quote:
Originally Posted by CalgonX
OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid))
{
SetSpawnInfo(....);
SpawnPlayer(....);
return 1;
}
}

Obviously, that was just a snippet.
same problem i am desperate
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)