SA-MP Forums Archive
animation for NPC (+ rep) - 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: animation for NPC (+ rep) (/showthread.php?tid=321794)



animation for NPC (+ rep) - WardenCS - 28.02.2012

Hello,i tried to add animation for NPC but the NPC just wont play it...
heres the npc.amx
Код:
#include <a_npc>
main(){}

public OnPlayerStreamIn(playerid)
{
	SendCommand("/crossarms2");
	return 1;
}
heres the onplayercommandtext
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/crossarms2", cmdtext, true) == 0) {
ApplyAnimation(playerid, "DEALER", "DEALER_IDLE", 4.0, 0, 1, 1, 1, -1); // Arms crossed 2
return 1;
}
return 1;
}
onplayerspawn

Код:
public OnPlayerSpawn(playerid)
{

	if(IsPlayerNPC(playerid))
	{
	SetPlayerSkin(playerid,113);
	SetPlayerPos(playerid,1416.1754,-6.8161,1000.9261);
	SetPlayerInterior(playerid,1);
	ApplyAnimation(playerid, "DEALER", "DEALER_IDLE", 4.0, 1, 0, 0, 0, 0);
	ApplyAnimation(playerid, "DEALER", "DEALER_IDLE", 4.0, 1, 0, 0, 0, 0);
	ApplyAnimation(playerid, "DEALER", "DEALER_IDLE", 4.0, 1, 0, 0, 0, 0);
	return 1;
	}....
anyone can see whats the problem?
thanks


Re: animation for NPC (+ rep) - WardenCS - 29.02.2012

heyho up!


Re: animation for NPC (+ rep) - WardenCS - 01.03.2012

bump!


Re: animation for NPC (+ rep) - WardenCS - 03.03.2012

bump!


Re: animation for NPC (+ rep) - DeathTone - 03.03.2012

This wouldn't work

An easy way is to load npcidle.amx for your bot, then add this in your gamemode:

pawn Код:
new NPCid = INVALID_PLAYERID;
public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid))
{
NPCid = playerid;
}
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/npccrossarms", cmdtext, true) == 0) {
if(NPCid == INVALID_PLAYERID)
{
return SendClientMessage(playerid, -1, "NPC is not connected!");
}
else
{
ApplyAnimation(NPCid, "DEALER", "DEALER_IDLE", 4.0, 0, 1, 1, 1, -1); // Arms crossed 2
SendClientMessage(playerid, -1, "Command sent to NPC");
return 1;
}
}
That should do the trick, also make sure you load npcidle.amx for your bot, or else it won't do any animations.