matito6 Posted February 11, 2012 Share Posted February 11, 2012 Hey. I do not know how to do the "setElementVelocity" was speeding to the front of the "0.30". Please help can there another way to speed up? Please help Link to comment
JR10 Posted February 11, 2012 Share Posted February 11, 2012 Use: function getElementSpeed ( element , unit ) if not element or not isElement ( element ) then return false end if unit == "kph" then unit = 1.61 else unit = 1 end local velX , velY , velZ = getElementVelocity ( element ) return ( velX ^ 2 + velY ^ 2 + velZ ^ 2 ) ^ 0.5 * unit * 100 end function setElementSpeed ( element , unit , speed ) if not element or not isElement ( element ) then return false end if not speed then speed = 0 end local acSpeed = getElementSpeed ( element , unit ) local diff = speed / acSpeed local velX , velY , velZ = getElementVelocity ( element ) setElementVelocity ( element , velX * diff , velY * diff , velZ * diff ) return true end Link to comment
matito6 Posted February 11, 2012 Author Share Posted February 11, 2012 I'm sorry, but what is the command for it to run it? . It could be / speed Euro Can it be done? Link to comment
Castillo Posted February 11, 2012 Share Posted February 11, 2012 These functions can be used to get/set a element speed, not just vehicles. Link to comment
matito6 Posted February 11, 2012 Author Share Posted February 11, 2012 Can somehow be done to accelerate on car? Link to comment
Castillo Posted February 11, 2012 Share Posted February 11, 2012 addCommandHandler("speed", function (thePlayer, cmd, theSpeed) local theSpeed = tonumber(theSpeed) local vehicle = getPedOccupiedVehicle(thePlayer) if (theSpeed and vehicle) setElementSpeed(vehicle, "kph", theSpeed) end end) function getElementSpeed ( element , unit ) if not element or not isElement ( element ) then return false end if unit == "kph" then unit = 1.61 else unit = 1 end local velX , velY , velZ = getElementVelocity ( element ) return ( velX ^ 2 + velY ^ 2 + velZ ^ 2 ) ^ 0.5 * unit * 100 end function setElementSpeed ( element, unit , speed ) if not element or not isElement ( element ) then return false end if not speed then speed = 0 end local acSpeed = getElementSpeed ( element , unit ) local diff = speed / acSpeed local velX , velY , velZ = getElementVelocity ( element ) setElementVelocity ( element , velX * diff , velY * diff , velZ * diff ) return true end That should add a command: /speed . Link to comment
matito6 Posted February 11, 2012 Author Share Posted February 11, 2012 it does not work. I would like to, if you type "/ speed Euro" I got the speed right away such that the car accelerated (DM maps) It can be done? 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