Apo Posted March 20, 2016 Share Posted March 20, 2016 hi I have a problem if the player is on the roof of the vehicle was moving when the player is on the roof of the vehicle remains please help me for disable surf all vehicle Link to comment
Captain Cody Posted March 21, 2016 Share Posted March 21, 2016 https://community.multitheftauto.com/in ... ils&id=360 ? Link to comment
Apo Posted March 21, 2016 Author Share Posted March 21, 2016 yes But i need default all vehicle attachElements disable Player misses the roof of the vehicle in each mode the vehicle is moving fast to stay and the roof fall Link to comment
Captain Cody Posted March 21, 2016 Share Posted March 21, 2016 I don't get what you mean. Link to comment
Moderators Citizen Posted March 22, 2016 Moderators Share Posted March 22, 2016 Pretty sure he wants that if the vehicle is moving, then any player standing on it should fall like in recent GTAs to be more realistic. Link to comment
Apo Posted March 22, 2016 Author Share Posted March 22, 2016 Pretty sure he wants that if the vehicle is moving, then any player standing on it should fall like in recent GTAs to be more realistic. yes man please help me Link to comment
Moderators Citizen Posted March 22, 2016 Moderators Share Posted March 22, 2016 I'm not at home actually so here is a draft of what you can use: Client side script: -- You can modify below: local speedUnit = "km/h" -- Possible values: "km/h", "mph" or "m/s" local minSpeed = 5 -- minimum speed before falling local exceptionList = { -- Boats: 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, -- add other vehicles here if needed } -- Function responsible for the "fall animation" -- fromSpeed is the speed the player is falling from function makeLocalPlayerFall( fromSpeed ) -- ultra basic fall animation (edit for more complex one): setElementVelocity( localPlayer, 0, 0, 1 ) end -- !! DO NOT MODIFY BELOW !! -- -- Maybe an infinite timer of 1 second won't make any difference but would reduce hardware consumption addEventHandler("onClientRender", root, function () local veh = getPedContactElement( localPlayer ) if not veh or isVehicleInExceptionList( veh ) then return end local speed = getElementSpeed( veh, speedUnit ) if speed >= minSpeed then makeLocalPlayerFall( speed ) end end) function isVehicleInExceptionList( veh ) if not exceptionList then return false end local model = getElementModel( veh ) for k, m in ipairs ( exceptionList ) do if model == m then return true end end return false end -- Taken from: [url=https://wiki.multitheftauto.com/wiki/GetElementSpeed]https://wiki.multitheftauto.com/wiki/GetElementSpeed[/url] function getElementSpeed(theElement, unit) -- Check arguments for errors assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")") assert(getElementType(theElement) == "player" or getElementType(theElement) == "ped" or getElementType(theElement) == "object" or getElementType(theElement) == "vehicle", "Invalid element type @ getElementSpeed (player/ped/object/vehicle expected, got " .. getElementType(theElement) .. ")") assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)") -- Default to m/s if no unit specified and 'ignore' argument type if the string contains a number unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit)) -- Setup our multiplier to convert the velocity to the specified unit local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456) -- Return the speed by calculating the length of the velocity vector, after converting the velocity to the specified unit return (Vector3(getElementVelocity(theElement)) * mult).length end Test it for me please (errors/warnings will be visible with /debugscript 3). Link to comment
Captain Cody Posted March 22, 2016 Share Posted March 22, 2016 Indeed a timer of 1 would reduce hardware consumption, on client render means it will happen up to 60 times a secound, now compare that with 1 time a secound, alot less power to run that. 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