Animation help! - 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: Animation help! (
/showthread.php?tid=562644)
Animation help! -
danish007 - 10.02.2015
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!
Re: Animation help! -
Sime30 - 10.02.2015
Use
GetPlayerAnimationIndex
Re: Animation help! -
CalvinC - 10.02.2015
pawn Код:
if(GetPlayerAnimationIndex(playerid) != 0) SendClientMessage(playerid, -1, "Please wait before performing another animation.");
Re: Animation help! -
danish007 - 11.02.2015
is there any function in which i have to use this or in commands?
Re: Animation help! -
CalvinC - 11.02.2015
Use it to detect if the player is using any animation.
Re: Animation help! -
andrewgrob - 11.02.2015
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;
}
Re: Animation help! -
danish007 - 11.02.2015
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.
Re: Animation help! -
CalvinC - 11.02.2015
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.
Re: Animation help! -
danish007 - 11.02.2015
timer will not work fine because some animations work for long time and some for short time :P