need help with apply animation :\
#1

hey people, i'm now posting to know how can i stop the animation after it is activated?
i created a timer to call this function, but the problem is that i don't know how to stop playing it. If i do with clear animation function, the timer will call it all the time anyway, so walking, entering cars, swiming, jumping animations, aiming, firing animations won't show up :S what can i do? thanks for help

Код:
public drunk(playerid)
{
	if(GetPlayerDrunkLevel(playerid) > 1000)
	{
    	ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1);
	}
            else if(GetPlayerDrunkLevel(playerid) > 500)
            {
            // what to do here? :S
            }
	return 1;
}
Reply
#2

https://sampwiki.blast.hk/wiki/ClearAnimations i think that should fix your problem.

pawn Код:
ClearAnimations(playerid);
Reply
#3

yea thats what i used, but as i said, my timer will call the function every time, so the walking, firing, aiming anims and all the stuff won'T be visible, it will be like if the player would move without walking if you understand what i mean :\
Reply
#4

Quote:
Originally Posted by pmk1
Посмотреть сообщение
yea thats what i used, but as i said, my timer will call the function every time, so the walking, firing, aiming anims and all the stuff won'T be visible, it will be like if the player would move without walking if you understand what i mean :\
Use this in declarations:

pawn Код:
new timer:Drunk(playerid);
And where you set the timer use Drunk instead of "drunk",

then you can put at that comment there:

pawn Код:
KillTimer(Drunk(playerid));
if im right

But why not doing the animation, setting the timer (with repeat on false) to stop it ?
so it will set a timer once for a player, and then the timer stops the animation and stops ticking.
Reply
#5

i only have SetTimer("drunk", 100, true);

should i have more? :\
Reply
#6

Do you need the
pawn Код:
else if(GetPlayerDrunkLevel(playerid) > 500)
            {
            // what to do here? :S
            }
part , or do you just want to reset it after a little while? , then try to use
pawn Код:
SetTimer("drunk", 100, false);

anyways 100 is a very short timer for an animation, you know it should be in miliseconds and not seconds or anything right ? so 100 = 0.1sec
Reply
#7

yea but, that's to prevent people from shooting,, sprinting or jumping while beeing drunk. Thanks i'll try what you just gave me
Reply
#8

if i well understand, you tell me to add new timerrunk(playerid); under defines, replace SetTimer("drunk",100, true); with SetTimer("Drunk",100, true); and to add in

else if(GetPlayerDrunkLevel(playerid) > 500)
{
KillTimer(Drunk(playerid));
}

like that?

i get 5 errors with that :S here:
Код:
C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\pmkfunserver.pwn(172) : error 001: expected token: ";", but found "(" // line with new timer:Drunk(playerid);
C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\pmkfunserver.pwn(626) : error 012: invalid function call, not a valid address // line with  KillTimer(Drunk(playerid));
C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\pmkfunserver.pwn(626) : warning 215: expression has no effect
C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\pmkfunserver.pwn(626) : error 001: expected token: ";", but found ")"
C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\pmkfunserver.pwn(626) : error 029: invalid expression, assumed zero
C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\pmkfunserver.pwn(626) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
thanks for the help
Reply
#9

Well actually (Drunk,100, true); without "" because its rleady declared, if it doesnt work upload your fs/gm and il try to fix it then
Reply
#10

What do you want to do with your script? Then i can help you, because I don't know why, you want to make him drunk, and clear the animation, drunk and clear, drunk and clear..and so on..:P I don't get it. Explain it and I'll make you a working script.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)