Check if player is using animation ?
#1

is there any function to check if player is using animation ?

GetPlayerAnimationIndex -->a found this but i don't now how to do that
Reply
#2

pawn Код:
if(GetPlayerAnimationIndex(playerid) != 0) // ... player is using some animation
Reply
#3

sorry to bring this up...but how can I check if the player is using one particular animation? I want to prevent players from punching..
Reply
#4

Maybe this code helps you:
pawn Код:
//OnPlayerUpdate for example, to be more accurate.
    if(GetPlayerAnimationIndex(playerid))
    {
        new animlib[32];
        new animname[32];
        new msg[128];
        GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
        format(msg, 128, "libary: %s || name: %s || index: %d", animlib, animname,GetPlayerAnimationIndex(playerid));
        SendClientMessage(playerid, 0xFFFFFFFF, msg);
    }
And when you discover punching index use GetPlayerAnimationIndex to check player's anim.
Reply
#5

Quote:
Originally Posted by irinel1996
Посмотреть сообщение
Maybe this code helps you:
pawn Код:
//OnPlayerUpdate for example, to be more accurate.
    if(GetPlayerAnimationIndex(playerid))
    {
        new animlib[32];
        new animname[32];
        new msg[128];
        GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
        format(msg, 128, "libary: %s || name: %s || index: %d", animlib, animname,GetPlayerAnimationIndex(playerid));
        SendClientMessage(playerid, 0xFFFFFFFF, msg);
    }
And when you discover punching index use GetPlayerAnimationIndex to check player's anim.
What's with the numbers? Sorry I am at the beggining of scripting right now, si I don't understand much of this. I don't need a message displayed or anything. I just want that animation to stop if the player is clicking (to punch).
Reply
#6

Edit:Nothing Smart
Reply
#7

Quote:
Originally Posted by HeLiOn_PrImE
Посмотреть сообщение
What's with the numbers? Sorry I am at the beggining of scripting right now, si I don't understand much of this. I don't need a message displayed or anything. I just want that animation to stop if the player is clicking (to punch).

pawn Код:
if(GetPlayerAnimationIndex(playerid))
    {
        new animlib[32];
        new animname[32];
        new msg[128];
        GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
        format(msg, 128, "libary: %s || name: %s || index: %d", animlib, animname,GetPlayerAnimationIndex(playerid));
        SendClientMessage(playerid, 0xFFFFFFFF, msg);
    }
How can you check:

pawn Код:
if(GetPlayerAnimationIndex(playerid))
    {
        new animlib[32];
        new animname[32];
        new msg[128];
        GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
        if(!strcmp(animname, "WALK_DRUNK", true)) {
          // the player is with walk drunk animation
        }
}
More details here:

https://sampwiki.blast.hk/wiki/ApplyAnimation
Reply
#8

I understand how to use the apply animation function. what I don't understand here, is what's with 32 and 128..
Reply
#9

These numbers are the pieces of data which can store the array, easier, how many characters can you insert into it. For example:
pawn Код:
//Let's take as example this word: WallHacker
/* If we count the characters we can see that there are 10 letters, 10 characters,
but would be better if we add one character more. So, now it should be:*/

new variable[11];
/*
You can give her any name, but don't use invalid symbols as ', ~, etc. You'll get errors when you compile.
*/

/*
To store numeric values, integers, just make normal variables as:*/

new variable;
I'd explain you more but, my English isn't very well. I don't want give you wrong information.
Take a look here too:https://sampwiki.blast.hk/wiki/Scripting_Basics#Arrays

Best regards!
Reply
#10

ok I get what's with the numbers (you explained very well thank you!!), but why do I need to store anything? I need to read the animation he is performing, and if it's the punch animation, it will stop before he does damage to the other player. That's it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)