From 0cf38cd896f80adce2e3236aa84feb6084a87d51 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Mon, 9 Sep 2024 18:07:33 +0200 Subject: [PATCH] chore: minor fixes for wk_wars2 --- .../wk_wars2x/cl_plate_reader.lua | 2 +- .../[esx_addons]/wk_wars2x/cl_radar.lua | 25 ++++++------------- .../[esx_addons]/wk_wars2x/cl_utils.lua | 7 +++--- .../[esx_addons]/wk_wars2x/config.lua | 2 +- 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/server-data/resources/[esx_addons]/wk_wars2x/cl_plate_reader.lua b/server-data/resources/[esx_addons]/wk_wars2x/cl_plate_reader.lua index aa0adfed9..f462b09ee 100644 --- a/server-data/resources/[esx_addons]/wk_wars2x/cl_plate_reader.lua +++ b/server-data/resources/[esx_addons]/wk_wars2x/cl_plate_reader.lua @@ -207,7 +207,7 @@ function READER:Main() -- Loop through front (1) and rear (-1) for i = 1, -1, -2 do -- Get the world position of the player's vehicle - local pos = GetEntityCoords(PLY.veh) + local _ = GetEntityCoords(PLY.veh) -- Get a start position 5m in front/behind the player's vehicle local start = GetOffsetFromEntityInWorldCoords(PLY.veh, 0.0, (5.0 * i), 0.0) diff --git a/server-data/resources/[esx_addons]/wk_wars2x/cl_radar.lua b/server-data/resources/[esx_addons]/wk_wars2x/cl_radar.lua index ec24fa997..e055d9e05 100644 --- a/server-data/resources/[esx_addons]/wk_wars2x/cl_radar.lua +++ b/server-data/resources/[esx_addons]/wk_wars2x/cl_radar.lua @@ -6,10 +6,7 @@ local tostring = tostring local math = math local pairs = pairs ---[[---------------------------------------------------------------------------------- - UI loading and key binds registering -----------------------------------------------------------------------------------]] --- +--[UI loading and key binds registering] local function RegisterKeyBinds() if UTIL:IsResourceNameValid() then UTIL:Log("Registering radar commands and key binds.") @@ -101,13 +98,10 @@ local function LoadUISettings() end end ---[[---------------------------------------------------------------------------------- - Radar variables +--[[Radar variables +NOTE - This is not a config, do not touch anything unless you know what +you are actually doing.]]-- - NOTE - This is not a config, do not touch anything unless you know what - you are actually doing. -----------------------------------------------------------------------------------]] --- RADAR = {} RADAR.vars = { -- Whether or not the radar's UI is visible @@ -677,7 +671,7 @@ function RADAR:UpdateOptionIndexes(loadSaved) -- Iterate through each of the internal settings for k, v in pairs(self.vars.settings) do -- Iterate through all of the menu options - for i, t in pairs(self.vars.menuOptions) do + for _, t in pairs(self.vars.menuOptions) do -- If the current menu option is the same as the current setting if t.settingText == k then -- Iterate through the option values of the current menu option @@ -693,10 +687,7 @@ function RADAR:UpdateOptionIndexes(loadSaved) end end ---[[---------------------------------------------------------------------------------- - Radar basics functions -----------------------------------------------------------------------------------]] --- +-- [Radar basics functions] -- Returns the patrol speed value stored function RADAR:GetPatrolSpeed() return self.vars.patrolSpeed @@ -1459,7 +1450,7 @@ function RADAR:GetVehiclesForAntenna() -- Check that the table for the current antenna is not empty if not UTIL:IsTableEmpty(vehs[ant]) then -- Get the 'strongest' vehicle for the antenna - for k, v in pairs(vehs[ant]) do + for _, v in pairs(vehs[ant]) do -- Check if the current vehicle item fits the mode set by the user if self:CheckVehicleDataFitsMode(ant, v.rayType) then -- Set the result for the current antenna @@ -1478,7 +1469,7 @@ function RADAR:GetVehiclesForAntenna() local temp = results[ant][1] -- Iterate through the vehicles for the current antenna - for k, v in pairs(vehs[ant]) do + for _, v in pairs(vehs[ant]) do -- When we grab a vehicle for the fastest section, as it is like how the real system works, there are a few -- additional checks that have to be made if self:CheckVehicleDataFitsMode(ant, v.rayType) and v.veh ~= temp.veh and v.size < temp.size and v.speed > temp.speed + 1.0 then diff --git a/server-data/resources/[esx_addons]/wk_wars2x/cl_utils.lua b/server-data/resources/[esx_addons]/wk_wars2x/cl_utils.lua index a62e82393..739afd789 100644 --- a/server-data/resources/[esx_addons]/wk_wars2x/cl_utils.lua +++ b/server-data/resources/[esx_addons]/wk_wars2x/cl_utils.lua @@ -18,7 +18,7 @@ function UTIL:FormatSpeed(speed) local pipes = "" -- Create a string of pipes (¦) for the number of spaces - for i = 1, 3 - string.len(text) do + for _ = 1, 3 - string.len(text) do pipes = pipes .. "¦" end @@ -64,7 +64,7 @@ end -- Old ray trace function for getting a vehicle in a specific direction from a start point function UTIL:GetVehicleInDirection(entFrom, coordFrom, coordTo) local rayHandle = StartShapeTestCapsule(coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z, 5.0, 10, entFrom, 7) - local _, _, _, _, vehicle = GetShapeTestResult(rayHandle) + local vehicle = GetShapeTestResult(rayHandle) return vehicle end @@ -112,10 +112,9 @@ end -- Used to draw text to the screen, helpful for debugging issues function UTIL:DrawDebugText(x, y, scale, centre, text) SetTextFont(4) - SetTextProportional(0) SetTextScale(scale, scale) SetTextColour(255, 255, 255, 255) - SetTextDropShadow(0, 0, 0, 0, 255) + SetTextDropShadow() SetTextEdge(2, 0, 0, 0, 255) SetTextCentre(centre) SetTextDropShadow() diff --git a/server-data/resources/[esx_addons]/wk_wars2x/config.lua b/server-data/resources/[esx_addons]/wk_wars2x/config.lua index 2a7d1cbe7..65cb342c1 100644 --- a/server-data/resources/[esx_addons]/wk_wars2x/config.lua +++ b/server-data/resources/[esx_addons]/wk_wars2x/config.lua @@ -35,7 +35,7 @@ CONFIG.use_sonorancad = false -- These keybinds can be changed by each person in their GTA Settings->Keybinds->FiveM CONFIG.keyDefaults = { -- Remote control key - remote_control = "f5", + remote_control = "f4", -- Radar key lock key key_lock = "l",