SA-MP Forums Archive
Idle NPC. - 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)
+--- Thread: Idle NPC. (/showthread.php?tid=517268)



Idle NPC. - Laure - 04.06.2014

Hi, i wanted to make a NPC which stands in a certain place holding a weapon and does no movement, i didnt see any tutorials regarding idle npcs , so if you guys know any Tutorials or if you can suggest me how to do it, i would appreciate that.
Thanks in advance.


Re: Idle NPC. - ]Rafaellos[ - 04.06.2014

Did you try to record it idle for 2-3 seconds? I think it should work, not sure tho.


Re: Idle NPC. - Laure - 04.06.2014

Fixed.


Re: Idle NPC. - amirab - 04.06.2014

use this in your OnGameModeInit:
PHP код:
ConnectNPC("MyNPC" "npcidle"); // npcidle means you should have a .pwn file in your npcmodes 
// you can find it in samp server files that uploaded in samp site 
then use this in OnPlayerConnect:
PHP код:
if(IsPlayerNPC(playerid) return 1
And use this in OnPlayerRequestClass:
PHP код:
if(IsPlayerNPC(playerid) return SpawnPlayer(playerid); 
And Finally use this in OnPlayerSpawn:
PHP код:
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid pName sizeof(pName));

if(!
strcmp(playername,"Taxi1",true))
{
     
SetPlayerPos(playerid ,,z);
     
SetPlayerFacingAngle(playerid angle);