Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better rotation of wheels #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 27 additions & 2 deletions esx-kr-vehicle-push/client.lua
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down