animation loop - 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 loop (
/showthread.php?tid=548234)
animation loop -
Snich - 28.11.2014
How can I stop looping the animation on OnPlayerUpdate(playerid). Animation repeat constantly...
Код:
new Float:Health;
GetPlayerHealth(playerid, Health);
if (Health <= 20.0)
{
LOWHP[playerid] = 0;
if(LOWHP[playerid] == 0)
{
ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die",9.1,0,1,1,1,1);
LOWHP[playerid] = 1;
return 1;
}
if(LOWHP[playerid] == 1)
{
return 1;
}
}
Respuesta: animation loop -
Snich - 28.11.2014
anyone?
Re: animation loop -
Sellize - 28.11.2014
Код:
while(LOWHP[playerid] == 0){
ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die",9.1,0,1,1,1,1);
}
Re: animation loop -
PowerPC603 - 28.11.2014
Just remove the first
LOWHP[playerid] = 0;
You force it to become 0 everytime OnPlayerUpdate is called, and therefore it to execute the animation.
After the animation, you set it to 1, which is ok, but the next time it's forced back to 0 again, running the animation again.
You can also remove the second if-statement because it's never executed.
If the LOWHP is 0, you execute the first if-statement and exit the callback using the "return 1;".
pawn Код:
new Float:Health;
GetPlayerHealth(playerid, Health);
if (Health <= 20.0)
{
if(LOWHP[playerid] == 0)
{
ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die",9.1,0,1,1,1,1);
LOWHP[playerid] = 1;
}
}
else
LOWHP[playerid] = 0;
return 1;
This should work.
Respuesta: Re: animation loop -
Snich - 28.11.2014
Quote:
Originally Posted by PowerPC603
Just remove the first
LOWHP[playerid] = 0;
You force it to become 0 everytime OnPlayerUpdate is called, and therefore it to execute the animation.
After the animation, you set it to 1, which is ok, but the next time it's forced back to 0 again, running the animation again.
You can also remove the second if-statement because it's never executed.
If the LOWHP is 0, you execute the first if-statement and exit the callback using the "return 1;".
pawn Код:
new Float:Health; GetPlayerHealth(playerid, Health); if (Health <= 20.0) { if(LOWHP[playerid] == 0) { ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die",9.1,0,1,1,1,1); LOWHP[playerid] = 1; } } else LOWHP[playerid] = 0;
return 1;
This should work.
|
Working! REP+ and thank you.