raventhegosh Posted November 5, 2020 Posted November 5, 2020 I new on MTA and i don't know much about LUA, can anyone help? MTA have a bug when U Press two times the jump button on bike, it jump too high, if anyone can reduce ou remove the jump, i'll will be happy.
Discord Moderators Tut Posted November 6, 2020 Discord Moderators Posted November 6, 2020 Thread moved to the English Scripting forum for best results 1
Discord Moderators Zango Posted November 6, 2020 Discord Moderators Posted November 6, 2020 local last_button_action = 0 function onClientKey(button, pressOrRelease) if not pressOrRelease then return end local boundKeys = getBoundKeys("vehicle_secondary_fire") if not boundKeys then return end if not boundKeys[button] then return end local tick = getTickCount() if tick - last_button_action < 500 then cancelEvent() return end last_button_action = tick end addEventHandler("onClientKey", root, onClientKey) This will limit the vehicle_secondary_fire control to once every 500 ms, it should be enough to block the super jump on bike. This applies to all vehicles, so you will need to check for vehicle type if you want to limit it to bikes. I used onClientKey because I can't find a smarter way. An alternative is binding a function to the vehicle_secondary_fire keys, but the user can change his binds midways and you would have to check for that at some interval. 1
raventhegosh Posted November 6, 2020 Author Posted November 6, 2020 1 hour ago, Zango said: local last_button_action = 0 function onClientKey(button, pressOrRelease) if not pressOrRelease then return end local boundKeys = getBoundKeys("vehicle_secondary_fire") if not boundKeys then return end if not boundKeys[button] then return end local tick = getTickCount() if tick - last_button_action < 500 then cancelEvent() return end last_button_action = tick end addEventHandler("onClientKey", root, onClientKey) This will limit the vehicle_secondary_fire control to once every 500 ms, it should be enough to block the super jump on bike. This applies to all vehicles, so you will need to check for vehicle type if you want to limit it to bikes. I used onClientKey because I can't find a smarter way. An alternative is binding a function to the vehicle_secondary_fire keys, but the user can change his binds midways and you would have to check for that at some interval. Thks Man, i'll try this S2
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