SA-MP Forums Archive
NPC problem - 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: NPC problem (/showthread.php?tid=100354)



NPC problem - PawnNewCommer - 04.10.2009

Please help with what there can be a problem. I have made FS npc for the server on a sample from gl_npcs.pwn. But when I load a server with it FS the train which LV goes only. Other two boats (train LS and SF) stand on the spawn. What there can be a problem? I use the modifed Godfather gamemode. I am below shown my FS:


Код:
#include <a_samp>
public OnFilterScriptInit()
{
	ConnectNPC("LSTrain","train_ls");
	ConnectNPC("SFTrain","train_sf");
	ConnectNPC("LVTrain","train_lv");
	return 1;
}


public OnPlayerSpawn(playerid)
{
  if(IsPlayerNPC(playerid)) 
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "LSTrain", true)) 
    {
      PutPlayerInVehicle(playerid,429,0);
      SetPlayerColor(playerid,0xFFFFFFFF);
      return 1;
    }
    if(!strcmp(npcname, "SFTrain", true))
    {
      PutPlayerInVehicle(playerid,425,0);
      SetPlayerColor(playerid,0xFFFFFFFF);
      return 1;
    }
    if(!strcmp(npcname, "LVTrain", true))
    {
      PutPlayerInVehicle(playerid,421,0);
	  SetPlayerColor(playerid,0xFFFFFFFF);
      return 1;
    }
    return 1;
  }
  //Other stuff for normal players goes here!
  return 1;
}



Re: NPC problem - V1ceC1ty - 04.10.2009

you need to tell the script that they are already logged in


Re: NPC problem - PawnNewCommer - 04.10.2009

Quote:
Originally Posted by √№ceC№ty
you need to tell the script that they are already logged in
i made this.
Код:
 
public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid)) 
  {
    gPlayerLogged[playerid] = 1;
    return 1;
  }
//other code
But it is not solve my problem.


Re: NPC problem - TheNooB - 04.10.2009

Код:
new Logged[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
	if(!IsPlayerNPC(playerid)) return 1;
     {
     Logged[playerid] = 1;
     }
     return 1;
}
This may change according to your system login

Right?


Re: NPC problem - PawnNewCommer - 04.10.2009

OnPlayerSpawn?
Unless in OnPlayerSpawn I should speak script that a NPC are already logged in and here again to put NPC in the vehicle??