08.07.2011, 14:24
Buenas. Resulta que estaba un poco aburrido editando el include seif_walk y empecй a cambiarle algunas cosas para simplificar algunas sentencias en el script, resulta que al aсadirlo como include en mi gm y darle a compilar, se me tilda el compilador de pawn, y se me tilda prбcticamente la computadora (y no es una pc con low features). No sй en que estarй metiendo la pata, si alguno se quiere romper un poco la cabeza y ayudarme les dejo el script original y el editado por mн.
Original
Editado:
Original
pawn Код:
/*
seif_walk - Walking styles by Seif
*/
/*x---------------------------------Important-------------------------------------x*/
//**INCLUDES**//
#include <a_samp>
/*x---------------------------------Defining-------------------------------------x*/
//**DEFINES**//
#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
//**VARIABLES**//
new walktime[MAX_PLAYERS];
new WalkStyle[MAX_PLAYERS];
//**NATIVES**//
/*
native SetPlayerWalkingStyle(playerid, style)
native GetPlayerWalkingStyle(playerid)
*/
/*x---------------------------------CallBacks-------------------------------------x*/
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
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);
return Walk_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
}
forward Walk_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
#define OnPlayerKeyStateChange Walk_OnPlayerKeyStateChange
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 1;
}
stock SetPlayerWalkingStyle(playerid, style)
{
WalkStyle[playerid] = style;
}
stock GetPlayerWalkingStyle(playerid)
{
return WalkStyle[playerid];
}
pawn Код:
/*
seif_walk - Walking styles by Seif
*/
/*x---------------------------------Important-------------------------------------x*/
//**INCLUDES**//
#include <a_samp>
/*x---------------------------------Defining-------------------------------------x*/
//**DEFINES**//
#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 HOLDING(%0) \
((newkeys & (%0)) == (%0))
#define FPRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
#define BEFORENLAST(%0) \
(((oldkeys & (%0) == (%0)) || ((newkeys & (%0)) == (%0)))
#define KEYS(%0) \
((keys & (%0)) == (%0))
#define UPDOWN(%0) \
((updown & (%0)) == (%0))
#define LEFTRIGHT(%0) \
((leftright & (%0)) == (%0))
//**VARIABLES**//
new walktime[MAX_PLAYERS];
new WalkStyle[MAX_PLAYERS];
//**NATIVES**//
/*
native SetPlayerWalkingStyle(playerid, style)
native GetPlayerWalkingStyle(playerid)
*/
// Functions
forward WalkAnim(playerid);
/*x---------------------------------CallBacks-------------------------------------x*/
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
// Esto es para ver si presiono las teclas para caminar.
if(((HOLDING(KEY_WALK)) && ((HOLDING(KEY_UP | KEY_DOWN | KEY_LEFT | KEY_RIGHT)) || (RELEASED(KEY_UP | KEY_DOWN | KEY_LEFT |KEY_RIGHT)))) || ((RELEASED(KEY_WALK)) && (HOLDING(KEY_UP | KEY_DOWN | KEY_LEFT |KEY_RIGHT))) && (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT))
{
walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);
}
return Walk_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
}
forward Walk_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
#define OnPlayerKeyStateChange Walk_OnPlayerKeyStateChange
public WalkAnim(playerid)
{
new keys, updown, leftright;
GetPlayerKeys(playerid,keys,updown,leftright);
if (GetPlayerWalkingStyle(playerid) == WALK_NORMAL)
{
if ((KEYS(KEY_WALK)) && ((UPDOWN(KEY_UP | KEY_DOWN)) || (LEFTRIGHT(KEY_LEFT | 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 | KEY_DOWN)) || (LEFTRIGHT(KEY_LEFT | 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 | KEY_DOWN)) || (LEFTRIGHT(KEY_LEFT | 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 | KEY_DOWN)) || (LEFTRIGHT(KEY_LEFT | 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 | KEY_DOWN)) || (LEFTRIGHT(KEY_LEFT | 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 | KEY_DOWN)) || (LEFTRIGHT(KEY_LEFT | 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 | KEY_DOWN)) || (LEFTRIGHT(KEY_LEFT | 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 | KEY_DOWN)) || (LEFTRIGHT(KEY_LEFT | 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 | KEY_DOWN)) || (LEFTRIGHT(KEY_LEFT | 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 | KEY_DOWN)) || (LEFTRIGHT(KEY_LEFT | 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 | KEY_DOWN)) || (LEFTRIGHT(KEY_LEFT | 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 | KEY_DOWN)) || (LEFTRIGHT(KEY_LEFT | 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 | KEY_DOWN)) || (LEFTRIGHT(KEY_LEFT | 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 1;
}
stock SetPlayerWalkingStyle(playerid, style)
{
WalkStyle[playerid] = style;
}
stock GetPlayerWalkingStyle(playerid)
{
return WalkStyle[playerid];
}