Jump to content

Script for the bike don't jump


raventhegosh

Recommended Posts

  • Discord Moderators
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.

  • Thanks 1
Link to comment
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

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...