SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 06/03/2014, 01:18 AM   #1
mahardika
Big Clucker
 
mahardika's Avatar
 
Join Date: Jul 2013
Location: ind-ONE-esia
Posts: 137
Reputation: 7
Default Make Custom Player Walk Style (in FS)

Player Walk Style by Mahardika

This Tutorial Will Change The Walk Style not use the UsePlayerPedAnims();

Sorry For The Bad English, if u found bug or somethin' Reply!

Okay Lets Go


First Of All We Need to include The Includes!
pawn Code:
//You cant do anything without this
#include <a_samp> //by Samp Team
// For Command Process (if you want to use it )
#include <zcmd> //by ZeeX

Add Some define For the walking Style
pawn Code:
//walkstyle defines by NewDIvine
#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)

// Define The Color
#define                                    COLOR_WHITE                                          0xFFFFFFFF //0xRRGGBBAA

And The Next We Need To Crate Player Variables
You Can Put it under all Defines
pawn Code:
new walktime[MAX_PLAYERS]; // for timer
new PlayerWalkStyle[MAX_PLAYERS]; // for the walk style
Strcmp Version, if you want to use this ( IF YOU WANT TO USE ZCMD DONT USE THIS LINE )
put under public OnPlayerCommandText(playerid, cmdtext[])
pawn Code:
new cmd[128], idx;
    cmd = strtok(cmdtext, idx); //This (strtok) is used to search a string and find a variable typed after a " " (space), then return it as a string.
    if (strcmp(cmd, "/walkstyle", true) == 0) // checking if he typed /walkstyle
    {
        new tmp[128];
        tmp = strtok(cmdtext, idx);
        if(strval(tmp) < 1 || strval(tmp) > 11)  //Check if the params is not lower then 1 and bigger then 11
            return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /walkstyle [1-11]");  // Send A Error Message
         
        SetPlayerWalkingStyle(playerid, strval(tmp)); // if Sucsess, Set The Player Walking Style
        return 1;
    }
( IF YOU WANT TO USE ZCMD DONT USE THIS LINE )
so it will be like this
PHP Code:
public OnPlayerCommandText(playeridcmdtext[])
{
    new 
cmd[128], idx;
    
cmd strtok(cmdtextidx); //This (strtok) is used to search a string and find a variable typed after a " " (space), then return it as a string.
    
if (strcmp(cmd"/walkstyle"true) == 0// checking if he typed /walkstyle
    
{
        new 
tmp[128];
        
tmp strtok(cmdtextidx);
        if(
strval(tmp) < || strval(tmp) > 11)  //Check if the params is not lower then 1 and bigger then 11
            
return SendClientMessage(playeridCOLOR_WHITE"USAGE: /walkstyle [1-11]");  // Send A Error Message
         
        
SetPlayerWalkingStyle(playeridstrval(tmp)); // if Sucsess, Set The Player Walking Style 
        
return 1;
    }
    return 
0;

ZCMD version ( no need public OnPlayerCommandText(playerid, cmdtext[]) )
Old : http://pastebin.com/1RjeqCm3
pawn Code:
//UPDATED Thanks To CrazyFrenzy
CMD:walkstyle(playerid, params[])
{
    if(strval(params) < 1 || strval(params) > 11)  //Check if the params is not lower then 1 and bigger then 11
        return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /walkstyle [1-11]");  // Send A Error Message
         
    SetPlayerWalkingStyle(playerid, strval(params)); // if Sucsess, Set The Player Walking Style
    return 1;
}

Put When The Player Spawning ( by default = OnPlayerSpawn )
To Load The Anim Lib
pawn Code:
PreloadAnimLib(playerid, "PED");

put in public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) to check player is walking
pawn Code:
//Check if player Pressing The Key
    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) { // if player are on foot, not at vehs
            walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid); // set the timer
    }

So it Will be like this

PHP Code:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    
//Check if player Pressing The Key
    
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) { // if player are on foot, not at vehs
            
walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid); // set the timer
    
}
    return 
1;

Stocks and Timer

Put it Under all The script
pawn Code:
stock SetPlayerWalkingStyle(playerid, style) // set the player walking style
{
    PlayerWalkStyle[playerid] = style;
}

stock GetPlayerWalkingStyle(playerid) // get the player walking style
{
    return PlayerWalkStyle[playerid];
}

stock PreloadAnimLib(playerid, animlib[])
{
    ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}
//UPDATED Thanks To CrazyFrenzy
//Old : [url]http://pastebin.com/8W2Hzfsg[/url]
forward WalkAnim(playerid); // forwarding the timer function
public WalkAnim(playerid)  // Function of The Timer
{
    new keys, updown, leftright;
    GetPlayerKeys(playerid,keys,updown,leftright); // Get The Player Pressed Key
    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))  // if player pressed Key to Walk
    {
        KillTimer(walktime[playerid]); // kill the walk timer if player was walked before
        switch(GetPlayerWalkingStyle(playerid))  //  switching The PlayerWalkStyle
        {
            //Aplly The Walk Anim
            case 1: ApplyAnimation(playerid,"PED","WALK_player",4.1,1,1,1,1,1);
            case 2: ApplyAnimation(playerid,"PED","WALK_civi",4.1,1,1,1,1,1);
            case 3: ApplyAnimation(playerid,"PED","WALK_gang1",4.1,1,1,1,1,1);
            case 4: ApplyAnimation(playerid,"PED","WALK_gang2",4.1,1,1,1,1,1);
            case 5: ApplyAnimation(playerid,"PED","WALK_old",4.1,1,1,1,1,1);
            case 6: ApplyAnimation(playerid,"PED","WALK_fatold",4.1,1,1,1,1,1);
            case 7: ApplyAnimation(playerid,"PED","WALK_fat",4.1,1,1,1,1,1);
            case 8: ApplyAnimation(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1);
            case 9: ApplyAnimation(playerid,"PED","WOMAN_walkbusy",4.1,1,1,1,1,1);
            case 10: ApplyAnimation(playerid,"PED","WOMAN_walkpro",4.1,1,1,1,1,1);
            case 11: ApplyAnimation(playerid,"PED","WOMAN_walksexy",4.1,1,1,1,1,1);
            case 12: ApplyAnimation(playerid,"PED","Walk_Wuzi",4.1,1,1,1,1,1);
            default: ClearAnimations(playerid);  // if player not choosed a Walk Style, Not Playing Anim
        }
        walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid); //Set The Timer For Looping The Anims
    }
    return true;
}  
strtok(const string[], &index) //This (strtok) is used to search a string and find a variable typed after a " " (space), then return it as a string.
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
 
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

Reseting The Player Variable
Put On OnPlayerConnect and on player dissconnect
pawn Code:
PlayerWalkStyle[playerid] = 0;

Is That All?
Yep!

if You Make This as FilterScript
it will look like
This! (With ZCMD)

PHP Code:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

//You cant do anything without this
#include <a_samp> //by Samp Team
// For Command Process (if you want to use it )
#include <zcmd> //by ZeeX

//walkstyle defines by NewDIvine
#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)

// Define The Color
#define                                    COLOR_WHITE                                          0xFFFFFFFF //0xRRGGBBAA

new walktime[MAX_PLAYERS]; // for timer
new PlayerWalkStyle[MAX_PLAYERS]; // for the walk style

#if defined FILTERSCRIPT // if this is a Filterscript

public OnFilterScriptInit() // func when filterscript was started
{
    print(
"\n--------------------------------------");
    print(
" Blank Filterscript by your name here");
    print(
" With Player Walking Style System By Mahardika!");
    print(
"--------------------------------------\n");
    return 
1;
}

public 
OnFilterScriptExit()
{
    return 
1;
}

#else

main()
{
    print(
"\n----------------------------------");
    print(
" Blank Gamemode by your name here");
    print(
"----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    
// Don't use these lines if it's a filterscript
    
SetGameModeText("Blank Script");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    return 
1;
}

public 
OnGameModeExit()
{
    return 
1;
}

public 
OnPlayerConnect(playerid)
{
    
PlayerWalkStyle[playerid] = 0;
    return 
1;
}

public 
OnPlayerDisconnect(playeridreason)
{
    
PlayerWalkStyle[playerid] = 0;
    return 
1;
}

public 
OnPlayerCommandText(playeridcmdtext[])
{
    new 
cmd[128], idx;
    
cmd strtok(cmdtextidx); //This (strtok) is used to search a string and find a variable typed after a " " (space), then return it as a string.
    
if (strcmp(cmd"/walkstyle"true) == 0// checking if he typed /walkstyle
    
{
        new 
tmp[128];
        
tmp strtok(cmdtextidx);
        if(
strval(tmp) < || strval(tmp) > 11)  //Check if the params is not lower then 1 and bigger then 11
            
return SendClientMessage(playeridCOLOR_WHITE"USAGE: /walkstyle [1-11]");  // Send A Error Message
         
        
SetPlayerWalkingStyle(playeridstrval(tmp)); // if Sucsess, Set The Player Walking Style 
        
return 1;
    }
    return 
0;
}

public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    
//Check if player Pressing The Key
    
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) { // if player are on foot, not at vehs
            
walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid); // set the timer
    
}
    return 
1;
}


CMD:walkstyle(playeridparams[]) 

    if(
strval(params) < || strval(params) > 11)  //Check if the params is not lower then 1 and bigger then 11
        
return SendClientMessage(playeridCOLOR_WHITE"USAGE: /walkstyle [1-11]");  // Send A Error Message
         
    
SetPlayerWalkingStyle(playeridstrval(params)); // if Sucsess, Set The Player Walking Style
    
return 1
}  

stock SetPlayerWalkingStyle(playeridstyle// set the player walking style
{
    
PlayerWalkStyle[playerid] = style;
}

stock GetPlayerWalkingStyle(playerid// get the player walking style
{
    return 
PlayerWalkStyle[playerid];
}

stock PreloadAnimLib(playeridanimlib[])
{
    
ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}

strtok(const string[], &index)
{
    new 
length strlen(string);
    while ((
index length) && (string[index] <= ' '))
    {
        
index++;
    }
 
    new 
offset index;
    new 
result[20];
    while ((
index length) && (string[index] > ' ') && ((index offset) < (sizeof(result) - 1)))
    {
        
result[index offset] = string[index];
        
index++;
    }
    
result[index offset] = EOS;
    return 
result;
}
//UPDATED Thanks To CrazyFrenzy
//Old : [url]http://pastebin.com/8W2Hzfsg[/url]
forward WalkAnim(playerid); // forwarding the timer function
public WalkAnim(playerid)  // Function of The Timer

    new 
keysupdownleftright
    
GetPlayerKeys(playerid,keys,updown,leftright); // Get The Player Pressed Key
    
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))  // if player pressed Key to Walk
    

        
KillTimer(walktime[playerid]); // kill the walk timer if player was walked before
        
switch(GetPlayerWalkingStyle(playerid))  //  switching The PlayerWalkStyle
        

            
//Aplly The Walk Anim
            
case 1ApplyAnimation(playerid,"PED","WALK_player",4.1,1,1,1,1,1); 
            case 
2ApplyAnimation(playerid,"PED","WALK_civi",4.1,1,1,1,1,1); 
            case 
3ApplyAnimation(playerid,"PED","WALK_gang1",4.1,1,1,1,1,1); 
            case 
4ApplyAnimation(playerid,"PED","WALK_gang2",4.1,1,1,1,1,1); 
            case 
5ApplyAnimation(playerid,"PED","WALK_old",4.1,1,1,1,1,1); 
            case 
6ApplyAnimation(playerid,"PED","WALK_fatold",4.1,1,1,1,1,1); 
            case 
7ApplyAnimation(playerid,"PED","WALK_fat",4.1,1,1,1,1,1); 
            case 
8ApplyAnimation(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1); 
            case 
9ApplyAnimation(playerid,"PED","WOMAN_walkbusy",4.1,1,1,1,1,1); 
            case 
10ApplyAnimation(playerid,"PED","WOMAN_walkpro",4.1,1,1,1,1,1); 
            case 
11ApplyAnimation(playerid,"PED","WOMAN_walksexy",4.1,1,1,1,1,1); 
            case 
12ApplyAnimation(playerid,"PED","Walk_Wuzi",4.1,1,1,1,1,1); 
            default: 
ClearAnimations(playerid);  // if player not choosed a Walk Style, Not Playing Anim
        

        
walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid); //Set The Timer For Looping The Anims
    

    return 
true


Thanks For Thanks To CrazyFrenzy To the Feedback

Last edited by mahardika; 07/03/2014 at 08:01 AM. Reason: Big Image
mahardika is offline   Reply With Quote
Old 06/03/2014, 01:54 AM   #2
Krisna
Big Clucker
 
Krisna's Avatar
 
Join Date: Jan 2013
Location: Indonesia
Posts: 162
Reputation: 10
Default Re: Player Walk Style

Not Bad
__________________
leave samp, play osu!
Krisna is offline   Reply With Quote
Old 06/03/2014, 04:52 AM   #3
mahardika
Big Clucker
 
mahardika's Avatar
 
Join Date: Jul 2013
Location: ind-ONE-esia
Posts: 137
Reputation: 7
Default Re: Player Walk Style

Quote:
Originally Posted by Krisna View Post
Not Bad
Thx yu
mahardika is offline   Reply With Quote
Old 06/03/2014, 05:21 AM   #4
CrazyFrenzy
Little Clucker
 
Join Date: Mar 2014
Posts: 20
Reputation: 1
Default Re: Player Walk Style

Thank you for the tutorial! You could have just make this to simplify the whole idea.

PHP Code:
CMD:walkstyle(playeridparams[])
{
    if(
strval(params) < || strval(params) > 11)
        return 
SendClientMessage(playeridCOLOR_WHITE"USAGE: /walkstyle [1-11]");
        
    
SetPlayerWalkingStyle(playeridstrval(params));
    return 
1;

And making the public even shorter -
PHP Code:
forward WalkAnim(playerid);
public 
WalkAnim(playerid)
{
    new 
keysupdownleftright;
    
GetPlayerKeys(playerid,keys,updown,leftright);
    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]);
        switch(
GetPlayerWalkingStyle(playerid))
        {
            case 
1ApplyAnimation(playerid,"PED","WALK_player",4.1,1,1,1,1,1);
            case 
2ApplyAnimation(playerid,"PED","WALK_civi",4.1,1,1,1,1,1);
            case 
3ApplyAnimation(playerid,"PED","WALK_gang1",4.1,1,1,1,1,1);
            case 
4ApplyAnimation(playerid,"PED","WALK_gang2",4.1,1,1,1,1,1);
            case 
5ApplyAnimation(playerid,"PED","WALK_old",4.1,1,1,1,1,1);
            case 
6ApplyAnimation(playerid,"PED","WALK_fatold",4.1,1,1,1,1,1);
            case 
7ApplyAnimation(playerid,"PED","WALK_fat",4.1,1,1,1,1,1);
            case 
8ApplyAnimation(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1);
            case 
9ApplyAnimation(playerid,"PED","WOMAN_walkbusy",4.1,1,1,1,1,1);
            case 
10ApplyAnimation(playerid,"PED","WOMAN_walkpro",4.1,1,1,1,1,1);
            case 
11ApplyAnimation(playerid,"PED","WOMAN_walksexy",4.1,1,1,1,1,1);
            case 
12ApplyAnimation(playerid,"PED","Walk_Wuzi",4.1,1,1,1,1,1);
            default: 
ClearAnimations(playerid);
        }
        
walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
    }
    return 
true;

CrazyFrenzy is offline   Reply With Quote
Old 06/03/2014, 05:22 AM   #5
RenovanZ
Gangsta
 
RenovanZ's Avatar
 
Join Date: Jul 2012
Location: Jogjakarta, Indonesia
Posts: 598
Reputation: 32
Default Re: Player Walk Style

You need to explain it more detail, so anyone can learn something from this tut.
____
Quote:
Originally Posted by CrazyFrenzy View Post
Thank you for the tutorial! You could have just make this to simplify the whole idea.

PHP Code:
CMD:walkstyle(playeridparams[])
{
    if(
strval(params) < || strval(params) > 11)
        return 
SendClientMessage(playeridCOLOR_WHITE"USAGE: /walkstyle [1-11]");
        
    
SetPlayerWalkingStyle(playeridstrval(params));
    return 
1;

And making the public even shorter -
PHP Code:
forward WalkAnim(playerid);
public 
WalkAnim(playerid)
{
    new 
keysupdownleftright;
    
GetPlayerKeys(playerid,keys,updown,leftright);
    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]);
        switch(
GetPlayerWalkingStyle(playerid))
        {
            case 
1ApplyAnimation(playerid,"PED","WALK_player",4.1,1,1,1,1,1);
            case 
2ApplyAnimation(playerid,"PED","WALK_civi",4.1,1,1,1,1,1);
            case 
3ApplyAnimation(playerid,"PED","WALK_gang1",4.1,1,1,1,1,1);
            case 
4ApplyAnimation(playerid,"PED","WALK_gang2",4.1,1,1,1,1,1);
            case 
5ApplyAnimation(playerid,"PED","WALK_old",4.1,1,1,1,1,1);
            case 
6ApplyAnimation(playerid,"PED","WALK_fatold",4.1,1,1,1,1,1);
            case 
7ApplyAnimation(playerid,"PED","WALK_fat",4.1,1,1,1,1,1);
            case 
8ApplyAnimation(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1);
            case 
9ApplyAnimation(playerid,"PED","WOMAN_walkbusy",4.1,1,1,1,1,1);
            case 
10ApplyAnimation(playerid,"PED","WOMAN_walkpro",4.1,1,1,1,1,1);
            case 
11ApplyAnimation(playerid,"PED","WOMAN_walksexy",4.1,1,1,1,1,1);
            case 
12ApplyAnimation(playerid,"PED","Walk_Wuzi",4.1,1,1,1,1,1);
            default: 
ClearAnimations(playerid);
        }
        
walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
    }
    return 
true;

I agree, your GM will be more optimized.
__________________
__________________________________________________
My Work(s)
__________________________________________________

RenovanZ is offline   Reply With Quote
Old 06/03/2014, 06:31 AM   #6
mahardika
Big Clucker
 
mahardika's Avatar
 
Join Date: Jul 2013
Location: ind-ONE-esia
Posts: 137
Reputation: 7
Default Re: Player Walk Style

Quote:
Originally Posted by CrazyFrenzy View Post
Thank you for the tutorial! You could have just make this to simplify the whole idea.

PHP Code:
CMD:walkstyle(playeridparams[])
{
    if(
strval(params) < || strval(params) > 11)
        return 
SendClientMessage(playeridCOLOR_WHITE"USAGE: /walkstyle [1-11]");
        
    
SetPlayerWalkingStyle(playeridstrval(params));
    return 
1;

And making the public even shorter -
PHP Code:
forward WalkAnim(playerid);
public 
WalkAnim(playerid)
{
    new 
keysupdownleftright;
    
GetPlayerKeys(playerid,keys,updown,leftright);
    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]);
        switch(
GetPlayerWalkingStyle(playerid))
        {
            case 
1ApplyAnimation(playerid,"PED","WALK_player",4.1,1,1,1,1,1);
            case 
2ApplyAnimation(playerid,"PED","WALK_civi",4.1,1,1,1,1,1);
            case 
3ApplyAnimation(playerid,"PED","WALK_gang1",4.1,1,1,1,1,1);
            case 
4ApplyAnimation(playerid,"PED","WALK_gang2",4.1,1,1,1,1,1);
            case 
5ApplyAnimation(playerid,"PED","WALK_old",4.1,1,1,1,1,1);
            case 
6ApplyAnimation(playerid,"PED","WALK_fatold",4.1,1,1,1,1,1);
            case 
7ApplyAnimation(playerid,"PED","WALK_fat",4.1,1,1,1,1,1);
            case 
8ApplyAnimation(playerid,"PED","WOMAN_walknorm",4.1,1,1,1,1,1);
            case 
9ApplyAnimation(playerid,"PED","WOMAN_walkbusy",4.1,1,1,1,1,1);
            case 
10ApplyAnimation(playerid,"PED","WOMAN_walkpro",4.1,1,1,1,1,1);
            case 
11ApplyAnimation(playerid,"PED","WOMAN_walksexy",4.1,1,1,1,1,1);
            case 
12ApplyAnimation(playerid,"PED","Walk_Wuzi",4.1,1,1,1,1,1);
            default: 
ClearAnimations(playerid);
        }
        
walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
    }
    return 
true;

Thanks for feedback
mahardika is offline   Reply With Quote
Old 06/03/2014, 06:42 AM   #7
mahardika
Big Clucker
 
mahardika's Avatar
 
Join Date: Jul 2013
Location: ind-ONE-esia
Posts: 137
Reputation: 7
Default Re: Player Walk Style

Quote:
Originally Posted by Kiyozi_Mu View Post
You need to explain it more detail, so anyone can learn something from this tut.
Okay Masvroh
mahardika is offline   Reply With Quote
Old 06/03/2014, 08:52 AM   #8
VenomMancer
Gangsta
 
VenomMancer's Avatar
 
Join Date: May 2013
Location: Indonesia (Manado)
Posts: 637
Reputation: 28
Default Re: Player Walk Style

Nice
I give you +REP1
VenomMancer is offline   Reply With Quote
Old 07/03/2014, 12:04 AM   #9
mahardika
Big Clucker
 
mahardika's Avatar
 
Join Date: Jul 2013
Location: ind-ONE-esia
Posts: 137
Reputation: 7
Default Re: Player Walk Style

Quote:
Originally Posted by VenomMancer View Post
Nice
I give you +REP1
thx yuuu
mahardika is offline   Reply With Quote
Old 07/03/2014, 08:02 AM   #10
mahardika
Big Clucker
 
mahardika's Avatar
 
Join Date: Jul 2013
Location: ind-ONE-esia
Posts: 137
Reputation: 7
Default Re: Player Walk Style

UPDATED
mahardika is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Change walk Style or CJ Run? Antonioh Scripting Help 19 08/01/2013 08:01 PM
GM Walk Style **Help**[+Rep] [E]ViL [D]RaGoN™ Scripting Help 2 18/12/2012 01:15 PM
Walk Style McCurdy Scripting Help 5 23/07/2012 10:30 AM
Walk style problem N0FeaR Scripting Help 2 15/05/2012 07:26 PM
changing walk and run style marwan Help Archive 1 12/06/2011 12:06 PM


All times are GMT. The time now is 10:54 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.