cruise control add key stop - S/Space

test-utf-8
rubin 2 years ago
parent 4be235b8a7
commit fc43b75078
  1. 44
      TruckHUD.lua

@ -1020,33 +1020,41 @@ function doPickup()
end
end
function check_press_key(table)
local result = false
local result_key_text = ""
for i = 1, #table do
if isKeyDown(vkeys[table[i]]) then
result = true
result_key_text = table[i]:gsub("VK_", "")
break
end
end
return result, result_key_text
end
cruise = false
function doCruise()
if not inifiles.Settings.Cruise then return end
if cruise == nil then cruise = false end
if not isCharInAnyCar(playerPed) then
additional_key_stop = { "VK_W", "VK_S", "VK_SPACE" }
local car = storeCarCharIsInNoSave(playerPed)
if not isCharInAnyCar(playerPed) or not isCarEngineOn(car) then
if cruise then
cruise = false
printStringNow('~R~Cruise Control - OFF', 1500)
printStringNow('~R~cruise control - OFF', 1500)
end
return
end
local car = storeCarCharIsInNoSave(playerPed)
if cruise and not isCarEngineOn(car) then
cruise = false
printStringNow('~R~Cruise Control - OFF', 1500)
return
end
if not sampIsChatInputActive( ) and not sampIsDialogActive( ) and not sampIsCursorActive( ) then
if pressW ~= nil and not isKeyDown(87) then
pressW = nil
end
if not cruise and isKeyDown(87) and isKeyDown(vkeys[inifiles.Settings.Key4]) and isCarEngineOn(car) and isCharInAnyCar(playerPed) then
if not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsCursorActive() then
if not cruise and isKeyDown(vkeys["VK_W"]) and isKeyDown(vkeys[inifiles.Settings.Key4]) then
repeat
wait(100)
until not isKeyDown(vkeys["VK_W"])
cruise = true
pressW = true
printStringNow('~G~Cruise Control - ON', 1500)
elseif cruise and not isKeyDown(vkeys[inifiles.Settings.Key4]) and isKeyDown(87) and pressW == nil then
printStringNow('~G~cruise control - ON', 1500)
elseif cruise and not isKeyDown(vkeys[inifiles.Settings.Key4]) and select(1, check_press_key(additional_key_stop)) then
cruise = false
printStringNow('~R~Cruise Control - OFF', 1500)
printStringNow('~R~cruise control - OFF', 1500)
end
end
if cruise then

Loading…
Cancel
Save