BolonZX Posted August 21, 2015 Share Posted August 21, 2015 So I'm making this script which consists of a moving steering wheel, however I'm having a few issues this is the code: client local theWheel = steer_dummy function SteerLeftDown(theVeh, player) local targetPlayer = getLocalPlayer (player) if isPedInVehicle(targetPlayer) then local rx, ry, rz = getVehicleComponentRotation(theVeh, "theWheel") setVehicleComponentRotation(theVeh, "theWheel", rx+1, ry, rz) end end function SteerLeftUp(theVeh, player) local targetPlayer = getLocalPlayer (player) if isPedInVehicle(targetPlayer) then local rx, ry, rz = getVehicleComponentRotation(theVeh, "theWheel") setVehicleComponentRotation(theVeh, "theWheel", rx+1, ry, rz) end end --# Right function SteerRightDown(theVeh, player) local targetPlayer = getLocalPlayer (player) if isPedInVehicle(targetPlayer) then local rx, ry, rz = getVehicleComponentRotation(theVeh, "theWheel") setVehicleComponentRotation(theVeh, "theWheel", rx-1, ry, rz) end end function SteerRightUp(theVeh, player) local targetPlayer = getLocalPlayer (player) if isPedInVehicle(targetPlayer) then local rx, ry, rz = getVehicleComponentRotation(theVeh, "theWheel") setVehicleComponentRotation(theVeh, "theWheel", rx-1, ry, rz) end end bindKey("vehicle_left", "down", SteerLeftDown) bindKey("vehicle_left", "up", SteerLeftUp) bindKey("vehicle_right", "down", SteerRightDown) bindKey("vehicle_right", "up", SteerRightUp) Link to comment
Walid Posted August 21, 2015 Share Posted August 21, 2015 I recommend you to read the wiki page. Many things wrong: - Key names - getLocalPlayer you don't know how to use it - there is no vehicle in your code you need to check it using getPedOccupiedVehicle. - Wrong Arguments Example function FunctionName(key, keyState) if isPedInVehicle(localPlayer) then local vehicle = getPedOccupiedVehicle (localPlayer) if vehicle then local rx, ry, rz = getVehicleComponentRotation(vehicle, "......") if key == "arrow_l" then -- Your code here elseif key == "arrow_r" then -- same thing here end end end end bindKey("arrow_l", "both", FunctionName) bindKey("arrow_r", "both", FunctionName) Link to comment
BolonZX Posted August 21, 2015 Author Share Posted August 21, 2015 Thank you, the code is much more cleaner now, however it doesn't work I will have try using other functions but at least the dummy works 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