Jump to content

Vehicle Jump Script, help community please!


y453bh

Recommended Posts

 

Hello,

what I want is that when I'm like this on a building or wall, It lets me do the jump without time restriction (the opposite of when I'm on the floor). That way I can press the key several times to go flying through the air.

wallrideSCREEN3.jpg

Link to comment
-- # Client Side
function addBindKey ( )
	bindKey ( 'lshift' , 'down' , JumpVehicle )
end
addEventHandler ( 'onClientResourceStart' , resourceRoot , addBindKey )

local State = false

function JumpVehicle ()
	if ( not isPedInVehicle ( localPlayer ) ) then return end
	if ( State == true ) then return end 
	local Vehicle = getPedOccupiedVehicle ( localPlayer )
	if ( Vehicle ) and ( getVehicleController(Vehicle) == localPlayer ) then
		local x , y , z = getElementVelocity ( Vehicle )
		if ( isLineOfSightClear ( x , y , z , x , y + 3 , z , true , false , false , true ) ) then 
			setElementVelocity ( Vehicle , x , y + 3 , z )
		end 
		if ( isLineOfSightClear ( x , y , z , x + 3 , y , z , true , false , false , true ) ) then 
			setElementVelocity ( Vehicle , x + 3 , y , z )
		end 
		State = true
		setTimer ( function ( )
        	State = false
		end , 1000 * 5 , 1 )
	end
end

 

@y453bh

Link to comment
On 10/04/2020 at 09:48, Infinity-War said:

-- # Client Side
function addBindKey ( )
	bindKey ( 'lshift' , 'down' , JumpVehicle )
end
addEventHandler ( 'onClientResourceStart' , resourceRoot , addBindKey )

local State = false

function JumpVehicle ()
	if ( not isPedInVehicle ( localPlayer ) ) then return end
	if ( State == true ) then return end 
	local Vehicle = getPedOccupiedVehicle ( localPlayer )
	if ( Vehicle ) and ( getVehicleController(Vehicle) == localPlayer ) then
		local x , y , z = getElementVelocity ( Vehicle )
		if ( isLineOfSightClear ( x , y , z , x , y + 3 , z , true , false , false , true ) ) then 
			setElementVelocity ( Vehicle , x , y + 3 , z )
		end 
		if ( isLineOfSightClear ( x , y , z , x + 3 , y , z , true , false , false , true ) ) then 
			setElementVelocity ( Vehicle , x + 3 , y , z )
		end 
		State = true
		setTimer ( function ( )
        	State = false
		end , 1000 * 5 , 1 )
	end
end

 

@y453bh

not working brother, it makes some weird boost

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...