animation for NPC (+ rep)
#1

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
Reply
#2

heyho up!
Reply
#3

bump!
Reply
#4

bump!
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)