SA-MP Forums Archive
Fix to the "NPCs cant spawn if theres a password" - 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: Fix to the "NPCs cant spawn if theres a password" (/showthread.php?tid=107512)



Fix to the "NPCs cant spawn if theres a password" - jameskmonger - 10.11.2009

Make your void "onplayerconnect" look something like this:

Код:
public OnPlayerConnect(playerid)
{
  if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
  {
  } else {
  //normal login stuff here
  }
	return 1;
}
Not tested, but should work.


Re: Fix to the "NPCs cant spawn if theres a password" - Kurence - 10.11.2009

Quote:
Originally Posted by jameskmonger
Make your void "onplayerconnect" look something like this:

Код:
public OnPlayerConnect(playerid)
{
  if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
  {
  } else {
  //normal login stuff here
  }
	return 1;
}
Not tested, but should work.
This won't work because it only checks if he is NPC ... it won't do anything else
Код:
public OnPlayerConnect(playerid)
{
  if(IsPlayerNPC(playerid)) SpawnPlayer(playerid);  
  return 1;
}
-This will work


Re: Fix to the "NPCs cant spawn if theres a password" - BMUK - 10.11.2009

The NPC will spawn itself. No need to use SpawnPlayer. The only reason that the NPC wont spawn if there are terms which the NPC doesnt meet

if(IsPlayerNPC(playerid)) return 1;

Before any log-in-before-spawn type terms is enough


Re: Fix to the "NPCs cant spawn if theres a password" - Kurence - 10.11.2009

Quote:
Originally Posted by (KU)MB
The NPC will spawn itself. No need to use SpawnPlayer. The only reason that the NPC wont spawn if there are terms which the NPC doesnt meet

if(IsPlayerNPC(playerid)) return 1;

Before any log-in-before-spawn type terms is enough
On my server i have to spawn him on connect because othervise he is flying at 0,0,0