AlexSwamp Posted November 8, 2017 Share Posted November 8, 2017 (edited) Hi! I would like to cancelEvent() the fire when i press the "tab" button. I tryed with this code, but it doesn't work. update: I think the 'onClientPlayerWeaponFire' can't cancelEvent(), but I do not know how to replace it. function playerPressedKey(button, press) if getElementData(localPlayer, "char >> usingWeapon")[1] then if (press) and button == "tab" then return true end return false end end addEventHandler("onClientKey", getRootElement(), playerPressedKey) addEventHandler('onClientPlayerWeaponFire',getRootElement(),function() if playerPressedKey then cancelEvent() end end) Edited November 8, 2017 by AlexSwamp Link to comment
Fist Posted November 8, 2017 Share Posted November 8, 2017 there's no need for that type of script, just disable control "action". Not sure if it's being used by other things but i just disable it when weapon is aiming but you can just put it in any client script and it'll work. toggleControl("action",false); 1 Link to comment
Xenius Posted November 8, 2017 Share Posted November 8, 2017 (edited) addEventHandler("onClientKey", root, function(k, state) if k == "tab" and params then cancelEvent() end end) Your code isn't working because you use "return", if you change it to cancelEvent() it will work. If function has "Cancel effect" on wiki, then you can use cancelEvent() https://puu.sh/yho2O/089bcce02b.png Edited November 8, 2017 by Xenius 1 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