Animation help!
#1

hello, how can i make like that if player is performing a animation and i use another animation command it should say me please wait before performing another animation? i mean it should not stop the current animation if we send one other animation it should complete current animation and if animation complete then i can be able to use another animation!
Reply
#2

Use GetPlayerAnimationIndex
Reply
#3

pawn Код:
if(GetPlayerAnimationIndex(playerid) != 0) SendClientMessage(playerid, -1, "Please wait before performing another animation.");
Reply
#4

is there any function in which i have to use this or in commands?
Reply
#5

Use it to detect if the player is using any animation.
Reply
#6

you could set a 5 or 10 second timer

pawn Код:
new WaitanimationTimer[MAX_PLAYERS]; // top of your script

forward WaitanimmationTimerOff(playerid); // under new WaitanimationTimer[MAX_PLAYERS];

make a new cmd like

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/dance", cmdtext, true, 5) == 0)
{
if(WaitanimationTimer[playerid] == 1)
{
 //some text here - like sendclient message
WaitanimationTimer[playerid] = 1;
SetTimer("WaitanimationTimerOff", 5000, 0); // 5000 is 5 seconds
return 1;
}
return 0;
}

& PUT THIS AT THE BOTTOM OF YOUR SCRIPT

public WaitanimationTimerOff(playerid)
{
if(WaitanimationTimer[playerid] == 1)
{
WaitanimationTimer[playerid] = 0;
return 0;
}
return 1;
}
Reply
#7

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
Use it to detect if the player is using any animation.
your code bewz!!!

[EDIT] Problem now i cant use any animation.
Reply
#8

Then you could use a variable and set it to 1 whenever you use an animation, and 0 whenever you stop an animation.
Then only allow players to use an animation if the variable is set to 0.
Reply
#9

timer will not work fine because some animations work for long time and some for short time :P
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)