NPC spawn Problem -
yellow - 13.04.2014
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;
}
Re: NPC spawn Problem -
Pottus - 13.04.2014
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.
AW: NPC spawn Problem -
yellow - 13.04.2014
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
Re: NPC spawn Problem -
Pottus - 13.04.2014
You can try SpawnPlayer(); that will make sure that they are spawning.
AW: NPC spawn Problem -
yellow - 13.04.2014
Tried it.
Now the NPC is connecting and disconnecting a little bit later
Re: NPC spawn Problem -
Pottus - 13.04.2014
Make sure something in your script is not kicking them.
AW: NPC spawn Problem -
yellow - 13.04.2014
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;
}
AW: NPC spawn Problem -
yellow - 14.04.2014
Maybe cause of the SendClientMessage?