Walking Style.
#1

Hello.

I need a help on Walking Style.. I want to add Walking Style in my script, in which players choose thier walkstyles.

So when they walk (Alt+W) they walk by the choosen style..

sry for my bad english (grammar)
Reply
#2

doesn't works i think,because you have to disable the default alt key function
Reply
#3

Hello,

1st of all

You gotta define those

pawn Код:
#define                     WALK_DEFAULT                        (0)
#define                     WALK_NORMAL                         (1)
#define                     WALK_PED                            (2)
#define                     WALK_GANGSTA                    (3)
#define                     WALK_GANGSTA2                   (4)
#define                     WALK_OLD                            (5)
#define                     WALK_FAT_OLD                    (6)
#define                     WALK_FAT                            (7)
#define                     WALK_LADY                           (8)
#define                     WALK_LADY2                          (9)
#define                     WALK_WHORE                          (10)
#define                     WALK_WHORE2                         (11)
#define                     WALK_DRUNK                          (12)
#define                     WALK_BLIND                          (13)
Then you will go to the Commands place.

// OnPlayerCommandText

and you will add this

pawn Код:
CMD:walkstyle(playerid, params[])
{
    new
        iSuccess;
    switch(strval(params))
    {
        case 1: { SetPlayerWalkingStyle(playerid, 0); iSuccess++; }
        case 2: { SetPlayerWalkingStyle(playerid, 3); iSuccess++; }
        case 3: { SetPlayerWalkingStyle(playerid, 4); iSuccess++; }
        case 4: { SetPlayerWalkingStyle(playerid, 5); iSuccess++; }
        case 5: { SetPlayerWalkingStyle(playerid, 6); iSuccess++; }
        case 6: { SetPlayerWalkingStyle(playerid, 8); iSuccess++; }
        case 7: { SetPlayerWalkingStyle(playerid, 9); iSuccess++; }
        case 8: { SetPlayerWalkingStyle(playerid, 10); iSuccess++; }
        case 9: { SetPlayerWalkingStyle(playerid, 11); iSuccess++; }
        case 10: { SetPlayerWalkingStyle(playerid, 12); iSuccess++; }
        case 11: { SetPlayerWalkingStyle(playerid, 13); iSuccess++; }
        default: SendClientMessage(playerid, COLOR_WHITE, "USAGE: /walkstyle [1-11]");
    }
    if(iSuccess > 0) SendClientMessage(playerid, COLOR_WHITE, "You are now using a new walking style.");
    return 1;
}
Then you gotta define the SetpLayerWalkingstyle

pawn Код:
stock SetPlayerWalkingStyle(playerid, style)
{
    PlayerInfo[playerid][pWalkStyle] = style;
}

stock GetPlayerWalkingStyle(playerid)
{
    return PlayerInfo[playerid][pWalkStyle];
}
forward WalkAnim(playerid);
public WalkAnim(playerid)
{
    new keys, updown, leftright;
    GetPlayerKeys(playerid,keys,updown,leftright);
    if (GetPlayerWalkingStyle(playerid) == WALK_NORMAL)
    {
        if ((keys & KEY_WALK && updown & KEY_UP) || (keys & KEY_WALK && updown & KEY_DOWN) || (keys & KEY_WALK && leftright & KEY_LEFT) || (keys & KEY_WALK && leftright & KEY_RIGHT))
        {
            KillTimer(walktime[playerid]);
            ApplyAnimation(playerid,"PED","WALK_player",4.1,1,1,1,1,1);
            walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
        }
        else ApplyAnimation(playerid,"PED","WALK_player",4.0,0,0,0,0,1), KillTimer(walktime[playerid]);
    }
    else if (GetPlayerWalkingStyle(playerid) == WALK_PED)
    {
        if ((keys & KEY_WALK && updown & KEY_UP) || (keys & KEY_WALK && updown & KEY_DOWN) || (keys & KEY_WALK && leftright & KEY_LEFT) || (keys & KEY_WALK && leftright & KEY_RIGHT))
        {
            KillTimer(walktime[playerid]);
            ApplyAnimation(playerid,"PED","WALK_civi",4.1,1,1,1,1,1);
            walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
        }
        else ApplyAnimation(playerid,"PED","WALK_civi",4.0,0,0,0,0,1), KillTimer(walktime[playerid]);
    }
    else if (GetPlayerWalkingStyle(playerid) == WALK_GANGSTA)
    {
        if ((keys & KEY_WALK && updown & KEY_UP) || (keys & KEY_WALK && updown & KEY_DOWN) || (keys & KEY_WALK && leftright & KEY_LEFT) || (keys & KEY_WALK && leftright & KEY_RIGHT))
        {
            KillTimer(walktime[playerid]);
            ApplyAnimation(playerid,"PED","WALK_gang1",4.1,1,1,1,1,1);
            walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
        }
        else ApplyAnimation(playerid,"PED","WALK_gang1",4.0,0,0,0,0,1), KillTimer(walktime[playerid]);
    }
    else if (GetPlayerWalkingStyle(playerid) == WALK_GANGSTA2)
    {
        if ((keys & KEY_WALK && updown & KEY_UP) || (keys & KEY_WALK && updown & KEY_DOWN) || (keys & KEY_WALK && leftright & KEY_LEFT) || (keys & KEY_WALK && leftright & KEY_RIGHT))
        {
            KillTimer(walktime[playerid]);
            ApplyAnimation(playerid,"PED","WALK_gang2",4.1,1,1,1,1,1);
            walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
        }
        else ApplyAnimation(playerid,"PED","WALK_gang2",4.0,0,0,0,0,1), KillTimer(walktime[playerid]);
    }
    else if (GetPlayerWalkingStyle(playerid) == WALK_OLD)
    {
        if ((keys & KEY_WALK && updown & KEY_UP) || (keys & KEY_WALK && updown & KEY_DOWN) || (keys & KEY_WALK && leftright & KEY_LEFT) || (keys & KEY_WALK && leftright & KEY_RIGHT))
        {
            KillTimer(walktime[playerid]);
            ApplyAnimation(playerid,"PED","WALK_old",4.1,1,1,1,1,1);
            walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
        }
        else ApplyAnimation(playerid,"PED","WALK_old",4.0,0,0,0,0,1), KillTimer(walktime[playerid]);
    }
    else if (GetPlayerWalkingStyle(playerid) == WALK_FAT_OLD)
    {
        if ((keys & KEY_WALK && updown & KEY_UP) || (keys & KEY_WALK && updown & KEY_DOWN) || (keys & KEY_WALK && leftright & KEY_LEFT) || (keys & KEY_WALK && leftright & KEY_RIGHT))
        {
            KillTimer(walktime[playerid]);
            ApplyAnimation(playerid,"PED","WALK_fatold",4.1,1,1,1,1,1);
            walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
        }
        else ApplyAnimation(playerid,"PED","WALK_fatold",4.0,0,0,0,0,1), KillTimer(walktime[playerid]);
    }
    else if (GetPlayerWalkingStyle(playerid) == WALK_FAT)
    {
        if ((keys & KEY_WALK && updown & KEY_UP) || (keys & KEY_WALK && updown & KEY_DOWN) || (keys & KEY_WALK && leftright & KEY_LEFT) || (keys & KEY_WALK && leftright & KEY_RIGHT))
        {
            KillTimer(walktime[playerid]);
            ApplyAnimation(playerid,"PED","WALK_fat",4.1,1,1,1,1,1);
            walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
        }
        else ApplyAnimation(playerid,"PED","WALK_fat",4.0,0,0,0,0,1), KillTimer(walktime[playerid]);
    }
    else if (GetPlayerWalkingStyle(playerid) == WALK_LADY)
    {
        if ((keys & KEY_WALK && updown & KEY_UP) || (keys & KEY_WALK && updown & KEY_DOWN) || (keys & KEY_WALK && leftright & KEY_LEFT) || (keys & KEY_WALK && leftright & KEY_RIGHT))
        {
            KillTimer(walktime[playerid]);
            ApplyAnimation(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1);
            walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
        }
        else ApplyAnimation(playerid,"PED","WOMAN_walknorm",4.0,0,0,0,0,1), KillTimer(walktime[playerid]);
    }
    else if (GetPlayerWalkingStyle(playerid) == WALK_LADY2)
    {
        if ((keys & KEY_WALK && updown & KEY_UP) || (keys & KEY_WALK && updown & KEY_DOWN) || (keys & KEY_WALK && leftright & KEY_LEFT) || (keys & KEY_WALK && leftright & KEY_RIGHT))
        {
            KillTimer(walktime[playerid]);
            ApplyAnimation(playerid,"PED","WOMAN_walkbusy",4.1,1,1,1,1,1);
            walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
        }
        else ApplyAnimation(playerid,"PED","WOMAN_walkbusy",4.0,0,0,0,0,1), KillTimer(walktime[playerid]);
    }
    else if (GetPlayerWalkingStyle(playerid) == WALK_WHORE)
    {
        if ((keys & KEY_WALK && updown & KEY_UP) || (keys & KEY_WALK && updown & KEY_DOWN) || (keys & KEY_WALK && leftright & KEY_LEFT) || (keys & KEY_WALK && leftright & KEY_RIGHT))
        {
            KillTimer(walktime[playerid]);
            ApplyAnimation(playerid,"PED","WOMAN_walkpro",4.1,1,1,1,1,1);
            walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
        }
        else ApplyAnimation(playerid,"PED","WOMAN_walkpro",4.0,0,0,0,0,1), KillTimer(walktime[playerid]);
    }
    else if (GetPlayerWalkingStyle(playerid) == WALK_WHORE2)
    {
        if ((keys & KEY_WALK && updown & KEY_UP) || (keys & KEY_WALK && updown & KEY_DOWN) || (keys & KEY_WALK && leftright & KEY_LEFT) || (keys & KEY_WALK && leftright & KEY_RIGHT))
        {
            KillTimer(walktime[playerid]);
            ApplyAnimation(playerid,"PED","WOMAN_walksexy",4.1,1,1,1,1,1);
            walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
        }
        else ApplyAnimation(playerid,"PED","WOMAN_walksexy",4.0,0,0,0,0,1), KillTimer(walktime[playerid]);
    }
    else if (GetPlayerWalkingStyle(playerid) == WALK_DRUNK)
    {
        if ((keys & KEY_WALK && updown & KEY_UP) || (keys & KEY_WALK && updown & KEY_DOWN) || (keys & KEY_WALK && leftright & KEY_LEFT) || (keys & KEY_WALK && leftright & KEY_RIGHT))
        {
            KillTimer(walktime[playerid]);
            ApplyAnimation(playerid,"PED","WALK_drunk",4.1,1,1,1,1,1);
            walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
        }
        else ApplyAnimation(playerid,"PED","WALK_drunk",4.0,0,0,0,0,1), KillTimer(walktime[playerid]);
    }
    else if (GetPlayerWalkingStyle(playerid) == WALK_BLIND)
    {
        if ((keys & KEY_WALK && updown & KEY_UP) || (keys & KEY_WALK && updown & KEY_DOWN) || (keys & KEY_WALK && leftright & KEY_LEFT) || (keys & KEY_WALK && leftright & KEY_RIGHT))
        {
            KillTimer(walktime[playerid]);
            ApplyAnimation(playerid,"PED","Walk_Wuzi",4.1,1,1,1,1,1);
            walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
        }
        else ApplyAnimation(playerid,"PED","Walk_Wuzi",4.0,0,0,0,0,1), KillTimer(walktime[playerid]);
    }
    return true;
}
Then go OnPlayerKeyStateChange and add this..


pawn Код:
if (((newkeys & KEY_WALK && newkeys & KEY_UP) || (newkeys & KEY_WALK && newkeys & KEY_DOWN) || (newkeys & KEY_WALK && newkeys & KEY_LEFT) || (newkeys & KEY_WALK && newkeys & KEY_RIGHT))
        || ((oldkeys & KEY_WALK && newkeys & KEY_UP) || (oldkeys & KEY_WALK && newkeys & KEY_DOWN) || (oldkeys & KEY_WALK && newkeys & KEY_LEFT) || (oldkeys & KEY_WALK && newkeys & KEY_RIGHT))
        || ((newkeys & KEY_WALK && oldkeys & KEY_UP) || (newkeys & KEY_WALK && oldkeys & KEY_DOWN) || (newkeys & KEY_WALK && oldkeys & KEY_LEFT) || (newkeys & KEY_WALK && oldkeys & KEY_RIGHT))
        && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
            walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
    }
And compile, and it will be working 100%
Reply
#4

@Kevin Fox, Thanks man its working. You forgot to tell me the pWalkStyle and saving it. But thanks its working good +rep
Reply
#5

He wants to change the ALTKey Running Style Kevin .
Reply
#6

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
He wants to change the ALTKey Running Style Kevin .
no ty bro, I wanted the Alt+W walking style by using /walkstyle

[sry for bad english]
Reply
#7

Quote:
Originally Posted by goldenneow
Посмотреть сообщение
@Kevin Fox, Thanks man its working. You forgot to tell me the pWalkStyle and saving it. But thanks its working good +rep
No proplem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)