IsPlayerRunning
#1

Hi guys,

Maybe someone have a function, to check, is player running? I know, I need to use GetPlayerAnimationIndex, but maybe someone already made this and can post it here ?

Thanks.
Reply
#2

Use

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(GetPlayerAnimationIndex(playerid))
    {
        new animlib[32];
        new animname[32];
        new msg[128];
        GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
        format(msg, 128, "Running anim: %s %s", animlib, animname);
        SendClientMessage(playerid, 0xFFFFFFFF, msg);
    }
    return 1;
}
and run, get the animation name and do this:

pawn Код:
#define RUNANIM_LIB "RUNNING"
#define RUNANIM_NAME "RUN" // Change these obviously, because they're not correct.

stock IsPlayerRunning ( playerid )
{
new animlib[32], animname[32];
GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);

if( strcmp( animlib, RUNANIM_LIB, false ) && strcmp( animname, RUNANIM_NAME, false ) )
{
return true;
}
else return false;
}
Sorry about the indentation, school computers.. blah. That's my guess on how to do it; otherwise, check out IsPlayerSwimming and modify that to your needs.
Reply
#3

pawn Код:
stock IsPlayerRunning(playerid)
{
    new
        keys,
        ud,
        lr;

    GetPlayerKeys(playerid, keys, ud, lr);
   
    if(keys & KEY_WALK)
        return false;

    if(ud == 0 && lr == 0)
        return false;

    return true;
}
Something like that should suffice. Not tested.
Reply
#4

Yeah, I know it, but some skins have different running animations(I think). I'm lazy and I need all these animations indexes .

EDIT: Vince, I need to check it by animation...
Reply
#5

Laziness is not an excuse.

https://sampwiki.blast.hk/wiki/Animations
Reply
#6

pawn Код:
IsPlayerRunning(playerid)
{
    new ai = GetPlayerAnimationIndex(playerid);
    if(ai == 1231 || ai == 1266) return 1;
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)