SA-MP Forums Archive
[Solved]Binding Key's to animations - 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: [Solved]Binding Key's to animations (/showthread.php?tid=84853)



[Solved]Binding Key's to animations - Buwla - 03.07.2009

How can i bind an animation so if you press both "aim key(not sure whats it called)"+"KEY_crouch" you do an animation?
I have tried this but it dosnt work:
pawn Код:
if ((newkeys==KEY_FIRE && newkeys==KEY_CROUCH))
  {
        ApplyAnimation(playerid,"FOOD","EAT_burger",3.0,0,0,0,0,0);
  }
Not going to use that anim just took an example

It works when i use one key but not when i use two, so i guess the probmen is there.


Re: Binding Key's to animations - Correlli - 03.07.2009

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
https://sampwiki.blast.hk/wiki/GetPlayerKeys


Re: Binding Key's to animations - Kyle - 03.07.2009

Simple...

Quote:

if (newkeys & KEY_SPRINT || newkeys & KEY_CROUCH)
{
DoSomething(playerid);
}



Re: Binding Key's to animations - Chaprnks - 03.07.2009

Quote:
Originally Posted by KyleSmith
Simple...

Quote:

if (newkeys & KEY_SPRINT || newkeys & KEY_CROUCH)
{
DoSomething(playerid);
}
He wants sprint key and crouch key, not one or the other.


Re: Binding Key's to animations - Buwla - 03.07.2009

Thanks, it works perfect.

EDIT: It works but you have to press both at the same time, so you can still cbugg without getting the animation if you time it.
Can i change so you cant use crouch while strafing instead?(i didnt find any strafing things on wiki.)

EDIT2: I just removed the "KEY_FIRE" and added
pawn Код:
&& GetPlayerWeapon(playerid) == WEAPON_DEAGLE)