Check if player is using animation ? -
Trac - 23.08.2011
is there any function to check if player is using animation ?
GetPlayerAnimationIndex -->a found this but i don't now how to do that
Re: Check if player is using animation ? -
Amit_B - 23.08.2011
pawn Код:
if(GetPlayerAnimationIndex(playerid) != 0) // ... player is using some animation
Re: Check if player is using animation ? -
HeLiOn_PrImE - 02.07.2012
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..
Respuesta: Check if player is using animation ? -
[DOG]irinel1996 - 02.07.2012
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.
Re: Respuesta: Check if player is using animation ? -
HeLiOn_PrImE - 02.07.2012
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).
Re: Check if player is using animation ? -
Roko_foko - 02.07.2012
Edit:Nothing Smart
Re: Respuesta: Check if player is using animation ? -
Ricop522 - 02.07.2012
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
Re: Check if player is using animation ? -
HeLiOn_PrImE - 02.07.2012
I understand how to use the apply animation function. what I don't understand here, is what's with 32 and 128..
Respuesta: Check if player is using animation ? -
[DOG]irinel1996 - 02.07.2012
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!
Re: Check if player is using animation ? -
HeLiOn_PrImE - 02.07.2012
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.