Why does it stop animations at all time? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why does it stop animations at all time? (
/showthread.php?tid=581883)
Why does it stop animations at all time? -
JaydenJason - 16.07.2015
So I've made this little code and I cut out a bit of it to save some space to make it easier to read;
Код:
public OnPlayerUpdate(playerid)
{
new Keys,ud,lr;
GetPlayerKeys(playerid,Keys,ud,lr);
if((ud == KEY_UP) && (HoldingForWalkstyle[playerid] == 1) && (UsingWalkstyle[playerid] == 0))
{
UsingWalkstyle[playerid] = 1;
switch(pData[playerid][pWalkStyle])
{
case 1: ApplyAnimation............ till case 15
}
}
... so it goes for every key (up/down/left/right)
return 1;
}
Now I've got this under OnPlayerKeyStateChange;
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(HOLDING(KEY_WALK))
{
if(!IsPlayerInAnyVehicle(playerid))
{
HoldingForWalkstyle[playerid] = 1;
}
}
if(PRESSED(KEY_WALK))
{
if(UsingWalkstyle[playerid] == 1 && !IsPlayerInAnyVehicle(playerid))
{
ApplyAnimationEx(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0);
}
}
return 1;
}
Why does this apply the animation at all times? Even when the walking animation isn't being played?