Fall off bike fix

Recommended Posts

I want to create a script that prevents the fall of the player from the bike while doing backflips and while having another player glued. The thing is it doesn't do what it is supposed to.

function onClientRender()
	if (isElementAttached(localPlayer) == true) then
		local naElement = getElementAttachedTo(localPlayer)
		if (getElementType(naElement) == "vehicle") then
			if (getVehicleType(naElement) == "Bike" or getVehicleType(naElement) == "BMX" or getVehicleType(vehicle) == "Quad") then
				local driver = getVehicleOccupant(naElement, 0)
				if (driver) then
					local rX, rY, rZ = getElementRotation(naElement)
					--outputChatBox("Bike rotation: x = " .. rX .. " y = " .. rY .. " z = " .. rZ)
					if (rX > 90 and rX < 300) then
						setPedCanBeKnockedOffBike(driver, true)
						outputChatBox(getPlayerName(driver) .. " is fixed")
						setPedCanBeKnockedOffBike(driver, false)
						outputChatBox(getPlayerName(driver) .. " is not fixed")
addEventHandler("onClientRender", root, onClientRender)


Share this post

Link to post

The thing is it doesn't do what it is supposed to.

Not specific enough...


Where does it go wrong? This code can't tell me right away what your problem is.







Share this post

Link to post

So, in my server i have configured "glue" script, which attach players to my vehicle. Recently, i found a bug that throws me away if I do backflips and if i have another player glued on. What i want to do is to force myself to not fall of when i do rotations and when i have someone glued on my bike

Edited by Clipper_

Share this post

Link to post

But what does this script has to do with the glue script?

Because the function setPedCanBeKnockedOffBike has no influence over the glue script.

Share this post

Link to post

I finished my script, restricting some cases when player could have felt off the bike in another way.

I request topic closed

Share this post

Link to post

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.