Timiimit Posted January 29, 2012 Posted January 29, 2012 (edited) Hi! I had a script that WORKED in 1.2 but not anymore in 1.3. could you tell me what is wrong with script? here it is: 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 function turn(thePlayer) local vehicle = getPedOccupiedVehicle(thePlayer) if (not vehicle) then return end local rX, rY, rZ = getElementRotation(vehicle) local Speeds = getElementSpeed(vehicle, "mph") setElementRotation(vehicle, rX, rY, rZ + 180) local Boost = 3 setTimer(setElementSpeed,50,1,vehicle,1,-Speeds+Boost) outputChatBox("#00FF00You turned your vehicle with #FF0000" .. tostring(Speeds) .. " mph", thePlayer) end function bindTheKey(p) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(p)),aclGetGroup("Admin")) then for index, player in pairs(getElementsByType("player")) do bindKey(player, "lctrl", "down", turn) outputChatBox("#00FF00You can press #0000FF'left ctrl' #00FF00in vehicle to turn for 180 degrees!", player, 255, 255, 255, true) end end end addCommandHandler("turningON",bindTheKey) function unBindTheKey(p) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(p)),aclGetGroup("Admin")) then for index, player in pairs(getElementsByType("player")) do unbindKey(player, "lctrl", "down", turn) outputChatBox("#FF0000Turning disabled!", player, 255, 255, 255, true) end end end addCommandHandler("turningOFF",unBindTheKey) Edited January 29, 2012 by Guest
Timiimit Posted January 29, 2012 Author Posted January 29, 2012 no errors. debugscript 3: nothing like its not running!??
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