Class problem due to NPC
#1

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.
Reply
#2

I really need help.Please help me.Sorry for repeating.
Reply
#3

code ?
Reply
#4

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.
Reply
#5

pawn Код:
OnPlayerRequestClass(playerid,classid)
{
  if(IsPlayerNPC(playerid)) return 1;

  //other code
  return 1;
}
same for OnPlayerSpawn
Reply
#6

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;
  }
Reply
#7

Bump..my problem still hasn't been solved...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)