SA-MP Forums Archive
How can i make npc that stand at the spawnpoint - 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: How can i make npc that stand at the spawnpoint (/showthread.php?tid=143091)



How can i make npc that stand at the spawnpoint - Ben147 - 21.04.2010

i tryed to make a record of stand at the spawnpoint but when i type after i finish /stoprecord
the record doesn't save in my records folder...
what can i do?


Re: How can i make npc that stand at the spawnpoint - boelie - 21.04.2010

did you search in the scriptfiles map ? it should be in there.
If you found it there just copy and paste it to the records map


Re: How can i make npc that stand at the spawnpoint - Ben147 - 21.04.2010

Yes , i found it in the scriptsfiles but i have more problem the npc allways teleport and spawn after afew seconds and it's doesn't stop


Re: How can i make npc that stand at the spawnpoint - Ben147 - 21.04.2010

I tryed now the npcidle and there to i have the same problem the npc allways teleport and back


Re: How can i make npc that stand at the spawnpoint - boelie - 21.04.2010

Hmmm..... ...

can you show me what you got under your onplayerspawn ?


Re: How can i make npc that stand at the spawnpoint - Ben147 - 21.04.2010

Код:
	if(IsPlayerNPC(playerid))
	{
	  new npcname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, npcname, sizeof(npcname));
		RequestNPCLoad(playerid,npcname);
		return 1;
	}

And this the requestnpcload public:


Код:
public RequestNPCLoad(playerid,npcname[])
{
	if(IsPlayerNPC(playerid))
	{
	  if(!strcmp(npcname, "Zak", true))
	  {
//	  SetSpawnInfo(playerid,255,125,2448.1091,-1963.3397,13.5469,171.5765, 0, 0, 0, 0, 0, 0 );
    SetPlayerSkin(playerid, 127);
    SetPlayerTeam(playerid, 0);
		SetPlayerPos(playerid, 2448.1091,-1963.3397,13.5469);
		SetPlayerFacingAngle(playerid, 171.5765);
	  
		  return 1;
		}
	}
 	return 1;
}



Re: How can i make npc that stand at the spawnpoint - boelie - 21.04.2010

You need to do it like this in your gamemode;
above ongamemodeinit;
#include <a_npc> (if you didnt do that already)

then under ongamemodeinit;
Код:
ConnectNPC("Zak","blabla*");
* = with blabla i mean the name of the npc script you made (so not the record)
Then under OnplayerSpawn make;
Код:
  if(IsPlayerNPC(playerid))
  {
  
  new npcname[MAX_PLAYER_NAME];
 	if(!strcmp(npcname, "Zak", true))
  {

    GetPlayerName(playerid, npcname, sizeof(npcname)); 
    if(!strcmp(npcname, "Zak", true))
    {
 		
    	SetPlayerSkin(playerid, 127);
    	SetPlayerTeam(playerid, 0);
		SetPlayerFacingAngle(playerid, 171.5765);			
	}
  }

  return 1;//end of onplayerspawn
  }
If you recorded an npc then you dont need setplayerpos because the recording will do that automaticly

If its still not working then ill need to see the npc script you made


Re: How can i make npc that stand at the spawnpoint - Ben147 - 21.04.2010

Still i have the same problem ....


Re: How can i make npc that stand at the spawnpoint - boelie - 21.04.2010

Then show us the npc script