SA-MP Forums Archive
OnPlayerStateChange 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerStateChange Help (/showthread.php?tid=167607)



OnPlayerStateChange Help - [LSB]TheGame - 13.08.2010

Ok im trying to do if player holds walk button he walks if he lets go of the button he stops

someone help? P.S everything is already defined

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (HOLDING(KEY_WALK))
{
if(UsesWalk[playerid] == 1)
{
ApplyAnimation(playerid,"ped","WALK_gang1",4.1,1,1,1,1,1);
}

else if (RELEASED(KEY_WALK))
{
//Stops Walking
}



}
	return 1;
}



Re: OnPlayerStateChange Help - Cameltoe - 13.08.2010

i think this is what your looking for: ClearAnimations(playerid);


Re: OnPlayerStateChange Help - [LSB]TheGame - 13.08.2010

ClearAnimations doesnt work on moving animations like walking i tried


Re: OnPlayerStateChange Help - Cameltoe - 13.08.2010

Apply a new anim then clear it?


Re: OnPlayerStateChange Help - [LSB]TheGame - 13.08.2010

Doesnt work because when i hold the walk button it plays the animation but when i let go still carrys playing on its maybe because its looped

Anyway i tried a easier way is like when you walk you use a command like a idle animation to stop but when i use it your frozed and i dont know what parametres to put for it so you can walk when uve used it

Код:
ApplyAnimation(playerid,"ped","Idle_Gang1",4.1,1,1,1,1,1);



Re: OnPlayerStateChange Help - Cameltoe - 13.08.2010

I'm not sure either, but there should be a way to stop looping anims :S..


Re: OnPlayerStateChange Help - [LSB]TheGame - 13.08.2010

Damn what about the parameters part?


Re: OnPlayerStateChange Help - [LSB]TheGame - 13.08.2010

LOL i didnt ask about fighting styles homie


Re: OnPlayerStateChange Help - [LSB]TheGame - 13.08.2010

you cant fix nothing


Re: OnPlayerStateChange Help - Cameltoe - 13.08.2010

Read about the function: https://sampwiki.blast.hk/wiki/ApplyAnimation try setting the loop to 1 sec or somthn.