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=177620)



NPC Problem - Libra_PL - 18.09.2010

I have got a problem... I have got two recorded NPCs npcmodes -> recording, two compiled files in npcmodes, and this script:

Код:
#include <a_samp>

new Line_1_Vehicle;
new Line_2_Vehicle;

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("Bots - succesfully loaded!");
     ConnectNPC("Line_1","Line_1");
    ConmectNPC("Line_2","Line_2");
    Line_1_Vehicle = AddStaticVehicle(431, 0.0, 0.0, 5.0, 0.0, 6, 666, 5000);
    Line_2_Vehicle = AddStaticVehicle(431, 0.0, 0.0, 5.0, 0.0, 6, 666, 5000);
    return 1;
)

#else

main()
{
    print("Bots - succesfully unloaded!");
}

#endif

public OnPlayerSpawn(playerid)
{
  if(IsPlayerNPC(playerid))
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "Line_1", true))
    {
      PutPlayerInVehicle(playerid, Line_1_Vehicle, 0);
      return 1;
    }
    if(!strcmp(npcname, "Line_2", true))
    {
      PutPlayerInVehicle(playerid, Line_2_Vehicle, 0);
      return 1;
    }
    return 1;
  }
  return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;
    return 1;
}
My NPCs can't connect. It's added to filterscripts in server.cfg, when I open the server, they don't connect (no message). Help?


Re: NPC Problem - [L3th4l] - 18.09.2010

Try using, OnPlayerConnect, because they have to connect first before they can request spawn right?


Re: NPC Problem - FireCat - 18.09.2010

in server.cfg maxnpc 10?


Re: NPC Problem - Libra_PL - 18.09.2010

I have them in OnFilterScriptInt, before I made bots in Gamemode (worked), now I used the same (some changes to Filterscript), it doesn't work.

And Fire, I have got:

Код:
maxnpc 2



Re: NPC Problem - Thebest96 - 18.09.2010

put 10 and your NPC'S are connected in GAMEMODEINIT?