SA-MP Forums Archive
NPCs, yeah me again... - 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: NPCs, yeah me again... (/showthread.php?tid=262355)



NPCs, yeah me again... - Markx - 17.06.2011

The facing angle isnt correct, so i tryd to set it but no effect, also the anim isnt working...

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname));
        if(!strcmp(npcname, "Dave", true))
        {
            SetPlayerSkin(playerid, 179);
            print("Skin done");
            SetPlayerFacingAngle(playerid, 269.7591);
            print("Facing angle done");
            ApplyAnimation(playerid,"COP_AMBIENT","Coplook_loop",4.1,0,0,0,1,0);
            print("Anim done");
            Dave[playerid] = Create3DTextLabel("Dave", 0x00FF0000, 30.0, 40.0, 50.0, 40.0, 0);
            Attach3DTextLabelToPlayer(Dave[playerid], playerid, 0.0, 0.0, 0.2);
            print("3D text done");
            return true;
        }
        return 1;
    }
    SetPlayerPos(playerid, 315.55523682,2059.98608398, 27); //NOTE: must change this to team spewns and make em random
    return true;
}
BTW, ignore the note ;P


Re: NPCs, yeah me again... - Stigg - 17.06.2011

Try pre loading the animation with:
pawn Код:
public OnPlayerConnect(playerid)
{
    PreloadAnimLib(playerid,"COP_AMBIENT");
    return 1;
}
With this anywhere else in your script:
pawn Код:
PreloadAnimLib(playerid, animlib[])
{
    ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}
I dont think you can set facing angle of the npc when it playing back the rec file.


Re: NPCs, yeah me again... - Markx - 17.06.2011

Quote:
Originally Posted by Stigg
Посмотреть сообщение
Try pre loading the animation with:
pawn Код:
public OnPlayerConnect(playerid)
{
    PreloadAnimLib(playerid,"COP_AMBIENT");
    return 1;
}
With this anywhere else in your script:
pawn Код:
PreloadAnimLib(playerid, animlib[])
{
    ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}
I dont think you can set facing angle of the npc when it playing back the rec file.
Same again..omfg i hate NPCs