From a0933ebeb7d72cbf5de471ddaa13dede4590adeb Mon Sep 17 00:00:00 2001 From: Cr4zZyBipBiip Date: Wed, 13 Mar 2019 01:17:18 +0100 Subject: [PATCH] Better rotation of wheels While pushing car, if you maintain A, wheels will rotate to left, same for D to right If you maintain W, it will rotate to center --- esx-kr-vehicle-push/client.lua | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/esx-kr-vehicle-push/client.lua b/esx-kr-vehicle-push/client.lua index f619bb9..175b46e 100644 --- a/esx-kr-vehicle-push/client.lua +++ b/esx-kr-vehicle-push/client.lua @@ -53,6 +53,10 @@ Citizen.CreateThread(function() end end) +local angle = 0.0 +local anglemax = 40.0 +local anglemin = -40.0 +local rotangle = 1.0 Citizen.CreateThread(function() while true do @@ -81,12 +85,33 @@ Citizen.CreateThread(function() local currentVehicle = Vehicle.Vehicle while true do Citizen.Wait(5) + local tangle = GetVehicleSteeringAngle(Vehicle.Vehicle) if IsDisabledControlPressed(0, Keys["A"]) then - TaskVehicleTempAction(PlayerPedId(), currentVehicle, 11, 1000) + --TaskVehicleTempAction(PlayerPedId(), currentVehicle, 11, 1000) + if angle < anglemax then + angle = angle + rotangle + SetVehicleSteeringAngle(Vehicle.Vehicle, angle) + end end if IsDisabledControlPressed(0, Keys["D"]) then - TaskVehicleTempAction(PlayerPedId(), currentVehicle, 10, 1000) + --TaskVehicleTempAction(PlayerPedId(), currentVehicle, 10, 1000) + if angle > anglemin then + angle = angle - rotangle + SetVehicleSteeringAngle(Vehicle.Vehicle, angle) + end + SetVehicleSteeringAngle(Vehicle.Vehicle, angle) + end + + if IsDisabledControlPressed(0, Keys["W"]) then + --TaskVehicleTempAction(PlayerPedId(), currentVehicle, 11, 1000) + if angle > 0.0 then + angle = angle - rotangle + SetVehicleSteeringAngle(Vehicle.Vehicle, angle) + elseif angle < 0.0 then + angle = angle + rotangle + SetVehicleSteeringAngle(Vehicle.Vehicle, angle) + end end if Vehicle.IsInFront then