How can i animate npc?!
#1

So here is what i did and it didn`t work any ideas?
pawn Код:
if(IsPlayerNPC(playerid))
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname));
        if(!strcmp(npcname, "Manager", true))
        {
            SetPlayerSkin(playerid,29);
            SetPlayerPos(playerid,-1757.3000488281,919.79998779,-48.599998474121);
            SetPlayerFacingAngle(playerid,90);
            ApplyAnimation(playerid,"INT_OFFICE","OFF_Sit_Type_Loop",4.1,1,1,1,1,1,1);
            return 1;
        }
        return 1;
    }
Reply
#2

I am using login system and I made recording but after I connect npc disconnects. I added if(IsPlayerNPC(playerid)) return 1; everywhere i needed any thoughts about this **** problem?!
Reply
#3

I've just added 3 print's to your script, could you please test it and repost the output of the console?

pawn Код:
if(IsPlayerNPC(playerid))
    {
        print("This player is a NPC, Procceeding.");
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname));
        if(!strcmp(npcname, "Manager", true))
        {
            print("The name of the NPC is Manager, Procceeding.");
            SetPlayerSkin(playerid, 29);
            SetPlayerPos(playerid, -1757.3000488281, 919.79998779, -48.599998474121);
            SetPlayerFacingAngle(playerid, 90);
            ApplyAnimation(playerid, "INT_OFFICE", "OFF_Sit_Type_Loop", 4.1, 1, 1, 1, 1, 1, 1);
            print("End of script reached.");
        }
        return 1;
    }
FIRST EDIT: Forgot to put " " between the lines of all prints.
Reply
#4

1. Make a recording (Using the default filterscript npc_record by Kye/Kalcor)
2. Cut the 'recording' from scriptfiles to 'npcmodes/recordings'.
3. In NPC modes create a PAWN Script.
4. In the new NPC Mode write:
pawn Код:
#include <a_npc>

main() return 0;

public OnNPCSpawn()
{
    StartRecordingPlayback(RECORDING_TYPE, RECORDING);
}

public OnRecordingPlaybackEnd()
{
    StartRecordingPlayback(RECORDING_TYPE, RECORDING);
}
Replace RECORDING_TYPE with the tipe that can be (Look in the a_npc include):
Код:
#define PLAYER_RECORDING_TYPE_NONE		0
#define PLAYER_RECORDING_TYPE_DRIVER	1
#define PLAYER_RECORDING_TYPE_ONFOOT	2
Replace RECORDING with the filename of your .rec file
5. Compile the NPCM
6. Go to your GM
7. When you want to connect the NPC add to the code
Код:
ConnectNPC(NPCMODE, NPCNAME);
Replace NPCMODE with the name of the previous script
Replace NPCNAME with the name you want the NPC connect to the server
8. Open server.cfg and make sure that the "maxnpc" line is > 0
-------------------

To make the NPC doing animations, you could create commands in-game that will apply that animations.

1.
Код:
if(!strcmp(cmdtext, "/sit", true))
{
    ApplyAnimation(...);
    return 1;
}
2. During the recording, type "/sit".
ApplyAnimation won't apply to the NPC if that anim isn't recorded.
Reply
#5

Quote:
Originally Posted by [GF]Sasino97
Посмотреть сообщение
ApplyAnimation won't apply to the NPC if that anim isn't recorded.
Oh, I didn't know this, perhaps because I never experiemented with it.
Thank you Sasino ^^.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)