NPCs join and leave
#1

as the title says the npcs I make join then leave for some unknown reason...

here is the code I put under onplayerspawn:

Код:
if(IsPlayerNPC(playerid)) 
  	{
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "Bus_Driver", true)) 
    {
      PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 431); 
    }
    return 1;
  	}
  	if(IsPlayerNPC(playerid))
  	{
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "Crazy_Train_Driver", true)) 
    {
      PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 538); 
    }
    return 1;
  	}
  	if(IsPlayerNPC(playerid))
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname));
        if(!strcmp(npcname, "Busdriver", true))
        {
        	PutPlayerInVehicle(playerid, NPCBus, 0);
        	SetPlayerSkin(playerid, 255);
        	ResetPlayerWeapons(playerid);
        }
        return 1;
    }
    if(IsPlayerNPC(playerid)) 
  	{
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname)); 
    if(!strcmp(npcname, "Helicopter", true)) 
    {
      PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 425); 
    }
    return 1;
  	}
any help?
Reply
#2

If your server has a login, put if(IsPlayerNPC(playerid)) return 1; before it makes the NPC login, Also put that in OnPlayerConnect OnPlayerRequestSpawn and OnPlayerRequestClass to be safe and then it should work.
Reply
#3

Quote:
Originally Posted by [WF]Demon
Посмотреть сообщение
If your server has a login, put if(IsPlayerNPC(playerid)) return 1; before it makes the NPC login, Also put that in OnPlayerConnect OnPlayerRequestSpawn and OnPlayerRequestClass to be safe and then it should work.
let me test and I'll post the results mate (:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)