nk0zkh0z Posted February 12, 2015 Share Posted February 12, 2015 Hello everyone, I want to ask about how to set the index of the vehicle? As the maximum speed, Accelerated speed for 5 seconds (for example) speed at least, I saw some server can do it. please help me, thank you everyone Link to comment
Et-win Posted February 12, 2015 Share Posted February 12, 2015 setElementVelocity --[[This one is more useful for vehicles if you just want to speed the vehicle forwards:]][url=https://wiki.multitheftauto.com/wiki/SetElementSpeed]https://wiki.multitheftauto.com/wiki/SetElementSpeed[/url] Link to comment
Professional Posted February 12, 2015 Share Posted February 12, 2015 Cods: function setElementSpeed(element, unit, speed) -- only work if element is moving! if (unit == nil) then unit = 0 end if (speed == nil) then speed = 0 end speed = tonumber(speed) local acSpeed = getElementSpeed(element, unit) if (acSpeed~=false) then -- if true - element is valid, no need to check again local diff = speed/acSpeed local x,y,z = getElementVelocity(element) setElementVelocity(element,x*diff,y*diff,z*diff) return true end return false end function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end addCommandHandler("AboShanabSpeed", function(player) local vehicle = getPedOccupiedVehicle(player) setElementSpeed(vehicle, "kph", 130) end) Link to comment
xeon17 Posted February 12, 2015 Share Posted February 12, 2015 And what isn't working? any errors in debugscript3? 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