WiBox Posted October 25, 2018 Share Posted October 25, 2018 I need to check if a key has been pressed.. Example I need to check if the key " space " has been pressed then it's like..; function theBinds() if ( is the key space has been pressed.. ) then -- bindKey( "arrow_u", "down", a) bindKey( "arrow_d", "down", b) bindKey( "arrow_l", "down", c) bindKey( "arrow_r", "down", d) else unBindKey( "arrow_u", "down", a) unBindKey( "arrow_d", "down", b) unBindKey( "arrow_l", "down", c) unBindKey( "arrow_r", "down", d) end end addEvent("setBinds", true) addEventHandler("setBinds", root, theBinds) Is there a way that will make me check if a key has been pressed? Link to comment
WorthlessCynomys Posted October 25, 2018 Share Posted October 25, 2018 You can use the client side event "onClientKey" or you can use the function "getKeyState". The first one gets called when you push or release a key. The second one returns if the key is currently pressed or not. Link to comment
WiBox Posted October 25, 2018 Author Share Posted October 25, 2018 Thanks a lot, I'll go check about it at the MTA wiki pedia.. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now