[Help] Animation problem
#1

Hello,

I need little help in animations that not works properly. The problem is for example "when we use /handsup its working but when we use simple chat suppose I press "t" and then write some thing then I press enter the animation automatically stop.

here is the code of my gamemode animation.

pawn Код:
if(strcmp(cmd, "/handsup", true) == 0)
    {
        if(PlayerInfo[playerid][pJailed] == 2)
        {
            SendClientMessage(playerid, COLOR_GREY, "You cannot do this right now!");
            return 1;
        }
        if(PlayerCuffed[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR_GREY, "You cannot do this right now!");
            return 1;
        }
        SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
        return 1;
    }

    if(strcmp(cmd,"/stopani",true) == 0 || strcmp(cmd,"/stopanim",true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            ApplyAnimation(playerid, "CARRY", "crry_prtial", 2.0, 0, 0, 0, 0, 0);
        }
        return 1;
    }

    if(strcmp(cmd, "/dance", true) == 0) {

            // Get the dance style param
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) {
                SendClientMessage(playerid,0xFF0000FF,"Usage: /dance [style 1-4]");
                return 1;
            }

            dancestyle = strval(tmp);
            if(dancestyle < 1 || dancestyle > 4) {
                SendClientMessage(playerid,0xFF0000FF,"Usage: /dance [style 1-4]");
                return 1;
            }

            if(dancestyle == 1) {
                SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE1);
            } else if(dancestyle == 2) {
                SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE2);
            } else if(dancestyle == 3) {
                SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE3);
            } else if(dancestyle == 4) {
                SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DANCE4);
            }
            return 1;
        }

    if(strcmp(cmd, "/rap", true) == 0) {

            // Get the dance style param
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) {
                SendClientMessage(playerid,0xFF0000FF,"Usage: /rap [style 1-3]");
                return 1;
            }

            rapstyle = strval(tmp);
            if(rapstyle < 1 || rapstyle > 3) {
                SendClientMessage(playerid,0xFF0000FF,"Usage: /rap [style 1-3]");
                return 1;
            }

            if(rapstyle == 1) {
            ApplyAnimationEx(playerid,"RAPPING","RAP_A_Loop",4.0,1,1,1,1,0);
            } else if(rapstyle == 2) {
            ApplyAnimationEx(playerid,"RAPPING","RAP_B_Loop",4.0,1,1,1,1,0);
            } else if(rapstyle == 3) {
            ApplyAnimationEx(playerid,"RAPPING","RAP_C_Loop",4.0,1,1,1,1,0);
            }
            return 1;
        }

    if(strcmp(cmd, "/wankoff", true) == 0) {

            // Get the dance style param
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) {
                SendClientMessage(playerid,0xFF0000FF,"Usage: /wankoff [style 1-3]");
                return 1;
            }

            wankstyle = strval(tmp);
            if(wankstyle < 1 || wankstyle > 3) {
                SendClientMessage(playerid,0xFF0000FF,"Usage: /wankoff [style 1-3]");
                return 1;
            }

            if(wankstyle == 1) {
            ApplyAnimationEx(playerid,"PAULNMAC","wank_in",4.0,1,1,1,1,0);
            } else if(wankstyle == 2) {
            ApplyAnimationEx(playerid,"PAULNMAC","wank_loop",4.0,1,1,1,1,0);
            } else if(wankstyle == 3) {
            ApplyAnimationEx(playerid,"PAULNMAC","wank_out",4.0,1,1,1,1,0);
            }
            return 1;
        }

    if(strcmp(cmd, "/strip", true) == 0) {

            // Get the dance style param
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) {
                SendClientMessage(playerid,0xFF0000FF,"Usage: /strip [style 1-7]");
                return 1;
            }

            stripstyle = strval(tmp);
            if(stripstyle < 1 || stripstyle > 7) {
                SendClientMessage(playerid,0xFF0000FF,"Usage: /strip [style 1-7]");
                return 1;
            }

            if(stripstyle == 1) {
            ApplyAnimationEx(playerid,"STRIP","strip_A",4.0,1,1,1,1,0);
            } else if(stripstyle == 2) {
            ApplyAnimationEx(playerid,"STRIP","strip_B",4.0,1,1,1,1,0);
            } else if(stripstyle == 3) {
            ApplyAnimationEx(playerid,"STRIP","strip_C",4.0,1,1,1,1,0);
            } else if(stripstyle == 4) {
            ApplyAnimationEx(playerid,"STRIP","strip_D",4.0,1,1,1,1,0);
            } else if(stripstyle == 5) {
            ApplyAnimationEx(playerid,"STRIP","strip_E",4.0,1,1,1,1,0);
            } else if(stripstyle == 6) {
            ApplyAnimationEx(playerid,"STRIP","strip_F",4.0,1,1,1,1,0);
            } else if(stripstyle == 7) {
            ApplyAnimationEx(playerid,"STRIP","strip_G",4.0,1,1,1,1,0);
            }
            return 1;
        }
Reply
#2

Maybe you're using ClearAnimations in OnPlayerText?
Reply
#3

pawn Код:
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_NONE) // do the talkin animation here
will work for every special action...if the player is dancing or using the cellphone or with hands up the talkin animation dont will be used.
Reply
#4

Pharrel's answer is good "again"
Reply
#5

Quote:
Originally Posted by Shelby
Посмотреть сообщение
Maybe you're using ClearAnimations in OnPlayerText?
Here is onplayerText:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new tmp[128];
    new string[128];
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "%s: ID:%d  TEXT: %s", sendername, playerid, text);
    TextLog(string);
    if (gPlayerLogged[playerid] == 0)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "[SERVER]: You are not logged in.");
        return 0;
    }
    else if(BenchPresses[playerid] != 0)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "You cannot use this while bench pressing.");
        return 0;
    }
    else if(Hospitalized[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, " You cannot do this right now !");
        return 0;
    }
    else if(Mute[playerid] == 1)
    {
        SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
        return 0;
    }
    else if(UsingSpawnBar[playerid] > 0)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, " You cannot do this right now !");
        return 0;
    }
Reply
#6

Quote:
Originally Posted by umarmalik
Посмотреть сообщение
Here is onplayerText:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new tmp[128];
    new string[128];
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "%s: ID:%d  TEXT: %s", sendername, playerid, text);
    TextLog(string);
    if (gPlayerLogged[playerid] == 0)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "[SERVER]: You are not logged in.");
        return 0;
    }
    else if(BenchPresses[playerid] != 0)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "You cannot use this while bench pressing.");
        return 0;
    }
    else if(Hospitalized[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, " You cannot do this right now !");
        return 0;
    }
    else if(Mute[playerid] == 1)
    {
        SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
        return 0;
    }
    else if(UsingSpawnBar[playerid] > 0)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, " You cannot do this right now !");
        return 0;
    }
Find the ApplyAnimation in OnPlayerText and put like this:

pawn Код:
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_NONE) ApplyAnimation(/*whatever is in your code*/);
Reply
#7

I searched but I does not find the ApplyAnimation in OnPlayerText.

Reply
#8

Is there ClearAnimations in OnPlayerText(See also(if you are using) in filterscript)?
If yes, delete it or use like Pharrel said:
pawn Код:
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_NONE) ClearAnimation(playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)