SA-MP Forums Archive
Setting Chat Animations with Dialog - 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: Setting Chat Animations with Dialog (/showthread.php?tid=362140)



Setting Chat Animations with Dialog - Noesis - 23.07.2012

Hello, so I am very new at scripting for SA-MP. I started scripting basic animations and dialogs. I now want to combine these two, but am unsure how to go about it.

What I would like to do is have a zcmd that brings up a dialog. From this dialog, a person can pick what animation will occure when he/she talks.

I've seen some code about setting animations to OnPlayerText, but I don't know how to connect that piece of code with my Dialog code.

Any help is appreciated. Thank you for reading.


Re: Setting Chat Animations with Dialog - Noesis - 23.07.2012

Little bump before work.

Like I said above, any help is appreciated. Thanks.


Re: Setting Chat Animations with Dialog - Ranama - 23.07.2012

well, you'll have to make a variable witch will keep in mind witch player-animation the player have selected.
so do a varialbe like
new talktype[MAX_PLAYERS];
and on the dialog you'll set the type to the talktype, like:
talktype[playerid] = listitem;
Or how how you want to do it.
and on the player text you'll set the animtype to the talktype like
public OnPlayerText{
//your old code here
switch(talktype[playerid]){
case 1:SetAnimation(playerid, blablabla other parameters and stuff);//first animation
case 2:SetAnimation(playerid, blablabla other parameters and stuff);//2nd animation
//and here you just fill upp with all your different animations
}
Hope i helped, ask if you need more help and I'll see if I see it


Re: Setting Chat Animations with Dialog - Noesis - 24.07.2012

I'll start working with this tonight! Thank you for the help!


Re: Setting Chat Animations with Dialog - Noesis - 24.07.2012

Okay so I have everything working perfectly thanks to the SA-MP forums, but I forgot one detail.

I don't want the talking animation to occur if they are already in an animation, like /sit.

I tried using GetPlayerAnimationIndex, but now it's not evening using the talking animation at all.

Part of code in question:


Code:
 case 1:
               {
                 if(!IsPlayerInAnyVehicle(playerid))
                  {
                    if(GetPlayerAnimationIndex(playerid) != 0)
                    {
                     }
                      else
                       {
                        ApplyAnimation(playerid,"MISC", "Idle_Chat_02" ,4.0, 1, 1, 1, 1, 1);
                        SetTimerEx("StopTalking", strlen(text)*200, 0, "i", playerid);
                       }
                  }
                }



Re: Setting Chat Animations with Dialog - Kindred - 24.07.2012

Quote:
Originally Posted by GetPlayerAnimationIndex, SA-MP Wiki
0 if there is no animation applied
You are checking if an animation IS Being used, and if it is, you would do the animation.

Switch it with this:

pawn Code:
case 1:
{
    if(!IsPlayerInAnyVehicle(playerid))
    {
        if(GetPlayerAnimationIndex(playerid) == 0)
        {
        }
        else
        {
            ApplyAnimation(playerid,"MISC", "Idle_Chat_02" ,4.0, 1, 1, 1, 1, 1);
            SetTimerEx("StopTalkinga", strlen(text)*200, 0, "i", playerid);
       }
    }
}
All I changed was GetPlayerAnimationIndex(playerid) != 0 to GetPlayerAnimationIndex(playerid) == 0

(NOTICE: I could be wrong, quite sleepy right now )


Re: Setting Chat Animations with Dialog - Noesis - 24.07.2012

My talking animation works again, but now it stands the character up if he's sitting.

Still not working as intended. Thanks for trying though


Re: Setting Chat Animations with Dialog - Noesis - 24.07.2012

Little bump before work like last time.


Re: Setting Chat Animations with Dialog - Kindred - 24.07.2012

Pretty sure my above post was wrong.

Try this:

pawn Code:
case 1:
{
    if(!IsPlayerInAnyVehicle(playerid))
    {
        if(GetPlayerAnimationIndex(playerid) == 0 && GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_NONE)
        {
            ApplyAnimation(playerid,"MISC", "Idle_Chat_02" ,4.0, 1, 1, 1, 1, 1);
            SetTimerEx("StopTalkinga", strlen(text)*200, 0, "i", playerid);
        }
        else
        {
        }
    }
}
This should check if the players animation AND players special action isn't in use, which will then do the chat animation.

You may have been doing SPECIAL_ACTION_SITTING or something.