NPC spawn Problem
#1

Hey guys.

Got this Problem:
The NPC is connecting after i typed a cmd.
The Bot connects, but he doesn't spawn.
Codes:

Код:
public OnPlayerRequestClass(playerid, classid)
{
	if(IsPlayerNPC(playerid))return 1;
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}
Код:
public OnPlayerSpawn(playerid)
{
	if(IsPlayerNPC(playerid))
	{
		new npcname[64];
		GetPlayerName(playerid,npcname,64);
		if(!strcmp(npcname,"Mission1",true))
		{
			SetPlayerPos(playerid,-738.1842,1648.0729,27.4358);
	    	SetPlayerSkin(playerid,33);
 			return 1;
		}
	}

	return 1;
}
Reply
#2

Are you sure the NPC is calling OnPlayerSpawn() ?

What I do is use the NPC script to let the main script know an NPC successfully connected then you know it's safe to use them.
Reply
#3

Hm..
Actually he should call OnPlayerSpawn, shouldn't he?
It worked with other NPC's either, but i put them in a car. This time i just want them to stay at the same pos. every time
Reply
#4

You can try SpawnPlayer(); that will make sure that they are spawning.
Reply
#5

Tried it.
Now the NPC is connecting and disconnecting a little bit later
Reply
#6

Make sure something in your script is not kicking them.
Reply
#7

Hm..maybe cause of this?
Код:
ocmd:story(playerid,params[])
{
	#pragma unused params
	switch(PlayerData[playerid][pLang])
	{
		case 0://german
		{
		    ClearChat(playerid);
 			SCM(playerid,-1," ***");
 			SCM(playerid,-1," ***. ");
 			SCM(playerid,-1," ***");
 			CreateDialogBox(playerid);
			UpdateDialogBox(playerid,"***");
			SCM(playerid,-1,"***");
			SCM(playerid,-1," *******");
			CreateQuestBox(playerid);
			UpdateQuestBox(playerid,"~y~***");
			SetPlayerCheckpoint(playerid,-765.2651,1627.2670,27.1172,4);
			MissionCP[playerid]=1;
			ConnectNPC("Mission1","DRIntro");
			PlayerPlaySound(playerid,1058,0,0,0);
		}
		case 1://english
		{
		    ClearChat(playerid);
		    SCM(playerid,-1," ***..");
		    SCM(playerid,-1,"***");
		    SCM(playerid,-1," ***.");
		    CreateDialogBox(playerid);
		    UpdateDialogBox(playerid,"~r~***u~n~~r\
		    What are you talkin' about?~n~~g~***");
		    SCM(playerid,-1," ** *** **");
		    SCM(playerid,-1," ** ***T **");
		  	CreateQuestBox(playerid);
			UpdateQuestBox(playerid,"~y~***);
			SetPlayerCheckpoint(playerid,-765.2651,1627.2670,27.1172,4);
			ConnectNPC("Mission1","DRIntro");
			MissionCP[playerid]=1;
		    PlayerPlaySound(playerid,1058,0,0,0);
		}
	}
	return 1;
}
Reply
#8

Maybe cause of the SendClientMessage?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)