BolonZX Posted August 21, 2015 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) In-game name: |-FMJ-|
Walid Posted August 21, 2015 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) Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
BolonZX Posted August 21, 2015 Author 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 In-game name: |-FMJ-|
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