#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)
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;
}
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;
}
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);
}
@Kevin Fox, Thanks man its working. You forgot to tell me the pWalkStyle and saving it. But thanks its working good +rep
|