Class problem due to NPC - 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: Class problem due to NPC (
/showthread.php?tid=122691)
Class problem due to NPC -
hk_shade - 23.01.2010
Hi,
I was wondering why I the OnPlayerRequestClass and OnPlayerSpawn function don't work before,but now I find it.I don't know why,when I added some NPC when the server starts,those function won't work.It is the same even I tried to delay loading the NPCs.If I can select class before they connect,everything works.
What's wrong?Please help me.
Re: No OnPlayerRequestClass,No random spawn? -
hk_shade - 23.01.2010
I really need help.Please help me.Sorry for repeating.
Re: No OnPlayerRequestClass,No random spawn? -
dice7 - 23.01.2010
code ?
Re: Class problem due to NPC -
hk_shade - 23.01.2010
Content of my question was modified.
The only thing goes wrong is the ConnectNPC function,and CreateVehicle function for the NPCs.
If you really need to know the code,please ask me again,because,sorry,I am not very willing to post my map before I release it.Please forgive me.
Re: Class problem due to NPC -
dice7 - 23.01.2010
pawn Код:
OnPlayerRequestClass(playerid,classid)
{
if(IsPlayerNPC(playerid)) return 1;
//other code
return 1;
}
same for OnPlayerSpawn
Re: Class problem due to NPC -
hk_shade - 23.01.2010
Sorry,but all are the same after added the script.
Also,I will set things for them when they spawn:
Код:
if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
if(!strcmp(npcname, "[NPC]Busline1", true)) //Checking if the NPC's name is MyFirstNPC
{
SetPlayerSkin(playerid,255);
PutPlayerInVehicle(playerid, busline1, 0); //Putting the NPC into the vehicle we created for it.
return 1;
}
if(!strcmp(npcname, "[NPC]Busline1_b", true))
{
SetPlayerSkin(playerid,255);
PutPlayerInVehicle(playerid, busline1_b, 0);
return 1;
}
if(!strcmp(npcname, "[NPC]Boatline1", true))
{
SetPlayerSkin(playerid,255);
PutPlayerInVehicle(playerid, boatline1, 0);
return 1;
}
return 1;
}
Re: Class problem due to NPC -
hk_shade - 26.01.2010
Bump..my problem still hasn't been solved...