[Solved]Binding Key's to animations
#1

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.
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
https://sampwiki.blast.hk/wiki/GetPlayerKeys
Reply
#3

Simple...

Quote:

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

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.
Reply
#5

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)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)