Setting Chat Animations with Dialog
#1

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

Little bump before work.

Like I said above, any help is appreciated. Thanks.
Reply
#3

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

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

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);
                       }
                  }
                }
Reply
#6

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

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

Little bump before work like last time.
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)