From a80f5f952a87969237117957d5c38e62d4294f24 Mon Sep 17 00:00:00 2001 From: MoskalykA <100430077+MoskalykA@users.noreply.github.com> Date: Wed, 1 Mar 2023 09:54:49 +0100 Subject: [PATCH 1/2] refactor: more logical code --- [core]/es_extended/client/functions.lua | 4 ++-- [core]/esx_context/main.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/[core]/es_extended/client/functions.lua b/[core]/es_extended/client/functions.lua index cd610edc..8e137eca 100644 --- a/[core]/es_extended/client/functions.lua +++ b/[core]/es_extended/client/functions.lua @@ -357,7 +357,7 @@ function ESX.Game.Teleport(entity, coords, cb) end function ESX.Game.SpawnObject(object, coords, cb, networked) - networked = networked == nil and true or networked + networked = networked or true if networked then ESX.TriggerServerCallback('esx:Onesync:SpawnObject', function(NetworkID) if cb then @@ -405,7 +405,7 @@ end function ESX.Game.SpawnVehicle(vehicle, coords, heading, cb, networked) local model = type(vehicle) == 'number' and vehicle or joaat(vehicle) local vector = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z) - networked = networked == nil and true or networked + networked = networked or true CreateThread(function() ESX.Streaming.RequestModel(model) diff --git a/[core]/esx_context/main.lua b/[core]/esx_context/main.lua index 55bfad9c..b497de6d 100644 --- a/[core]/esx_context/main.lua +++ b/[core]/esx_context/main.lua @@ -13,7 +13,7 @@ function Post(fn,...) end function Open(position,eles,onSelect,onClose,canClose) - local canClose = canClose == nil and true or canClose + local canClose = canClose or true activeMenu = { position = position, eles = eles, From b8e29f6538976084da84538995811c8d579d6310 Mon Sep 17 00:00:00 2001 From: MoskalykA <100430077+MoskalykA@users.noreply.github.com> Date: Wed, 1 Mar 2023 10:04:48 +0100 Subject: [PATCH 2/2] refactor: more logical code --- [core]/es_extended/server/functions.lua | 2 +- [core]/esx_menu_list/client/main.lua | 2 +- [core]/esx_multicharacter/client/main.lua | 6 +++--- [core]/esx_multicharacter/server/main.lua | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/[core]/es_extended/server/functions.lua b/[core]/es_extended/server/functions.lua index 1b48771a..90bdd48e 100644 --- a/[core]/es_extended/server/functions.lua +++ b/[core]/es_extended/server/functions.lua @@ -103,7 +103,7 @@ function ESX.RegisterCommand(name, group, cb, allowConsole, suggestion) end end - if v.validate == false then + if not v.validate then error = nil end diff --git a/[core]/esx_menu_list/client/main.lua b/[core]/esx_menu_list/client/main.lua index aad1f8d7..4d0af0c9 100644 --- a/[core]/esx_menu_list/client/main.lua +++ b/[core]/esx_menu_list/client/main.lua @@ -29,7 +29,7 @@ CreateThread(function() }) for k,v in pairs(OpenedMenus) do - if v == true then + if v then OpenedMenuCount = OpenedMenuCount + 1 end end diff --git a/[core]/esx_multicharacter/client/main.lua b/[core]/esx_multicharacter/client/main.lua index b0ee83de..4e1357b7 100644 --- a/[core]/esx_multicharacter/client/main.lua +++ b/[core]/esx_multicharacter/client/main.lua @@ -95,7 +95,7 @@ if ESX.GetConfig().Multichar then end SetupCharacter = function(index) - if spawned == false then + if not spawned then exports.spawnmanager:spawnPlayer({ x = Config.Spawn.x, y = Config.Spawn.y, @@ -188,7 +188,7 @@ if ESX.GetConfig().Multichar then if not v.model and v.skin then if v.skin.model then v.model = v.skin.model elseif v.skin.sex == 1 then v.model = mp_f_freemode_01 else v.model = mp_m_freemode_01 end end - if spawned == false then SetupCharacter(Character) end + if not spawned then SetupCharacter(Character) end local label = v.firstname..' '..v.lastname if Characters[k].disabled then elements[#elements+1] = {title = label,icon = "fa-regular fa-user", value = v.id} @@ -318,7 +318,7 @@ if ESX.GetConfig().Multichar then if Config.Relog then RegisterCommand('relog', function(source, args, rawCommand) - if canRelog == true then + if canRelog then canRelog = false TriggerServerEvent('esx_multicharacter:relog') ESX.SetTimeout(10000, function() diff --git a/[core]/esx_multicharacter/server/main.lua b/[core]/esx_multicharacter/server/main.lua index 65d84d46..cce710f0 100644 --- a/[core]/esx_multicharacter/server/main.lua +++ b/[core]/esx_multicharacter/server/main.lua @@ -1,6 +1,6 @@ if not ESX then error('\n^1Unable to start Multicharacter - you must be using ESX Legacy^0') -elseif ESX.GetConfig().Multichar == true then +elseif ESX.GetConfig().Multichar then local DATABASE do local connectionString = GetConvar('mysql_connection_string', ''); if connectionString == '' then