SA-MP Forums Archive
NPC's Not playing Animations. - 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: NPC's Not playing Animations. (/showthread.php?tid=319230)



NPC's Not playing Animations. - Hoborific - 18.02.2012

Alright so I have been having problems with NPC's for the last week now, this is my current code

pawn Код:
public OnGameModeInit()
{
    loadnpcs();
}

forward loadnpcs();
public loadnpcs()
{

    ConnectNPC("Hobo","Hobo");
    return 1;

}


forward Hobo();
public Hobo()
{

    ApplyAnimation(0, "CRACK", "crckidle2", 4.0, 0, 0, 0, 0, 1);
    return 1;

}
pawn Код:
public OnPlayerSpawn(playerid)
{
    ApplyAnimation(playerid, "CRACK", "Null", 4.0, 0, 0, 0, 0, 1);
    ApplyAnimation(playerid, "CRACK", "Null", 4.0, 0, 0, 0, 0, 1)

    if(IsPlayerNPC(playerid))
    {
        new name[24];GetPlayerName(playerid,name,24);
        if(strcmp(name,"Hobo",true) )
        {
            SetPlayerSkin(playerid,230);
            SetTimer("Hobo",1000,0);
            return 1;
        }
       
        if(strcmp(name,"Hobo2",true)!=0)
        {
            SetPlayerSkin(playerid, 230);
            return 1;
        }
    }
pawn Код:
public OnPlayerStreamIn(playerid, forplayerid)
{
    if(playerid == 0)
    {
   
        ApplyAnimation(0, "CRACK", "crckidle2", 4,0,0,0,0,1);
        return 1;
    }
    return 1;
}
I have tried if(forplayerid == 0) too, no luck.

pawn Код:
#include <a_npc>

//------------------------------------------

main()
{

}

public OnNPCSpawn()
{
    //SetMyPos(-580.7319,2612.1948,53.9348);
    StartRecordingPlayback(2,"Hobo");
    PauseRecordingPlayback();
    return 1;

}
//------------------------------------------
NPC MiniScript.

All help is appreciated


Re: NPC's Not playing Animations. - Soumi - 18.02.2012

I think you need to play the animation while your recording for the NPC.


Re: NPC's Not playing Animations. - Hoborific - 18.02.2012

Quote:
Originally Posted by Soumi
Посмотреть сообщение
I think you need to play the animation while your recording for the NPC.
Thank you so much rep++, I spent a week on this thing, I wrote some unbelievably complicated code, and you come along like a godsend, I think I am used to the old system or something, Before I didn't even need a playback I could just SetMyPos and apply the animation.