From b58e2ac467d201bf67716737f2865e9df0b623f5 Mon Sep 17 00:00:00 2001 From: MoskalykA <100430077+MoskalykA@users.noreply.github.com> Date: Wed, 30 Aug 2023 14:13:11 +0200 Subject: [PATCH 1/6] feat: be able to disable ammunition display --- [core]/es_extended/client/main.lua | 4 ++++ [core]/es_extended/config.lua | 1 + 2 files changed, 5 insertions(+) diff --git a/[core]/es_extended/client/main.lua b/[core]/es_extended/client/main.lua index 1d952509..e7df11b4 100644 --- a/[core]/es_extended/client/main.lua +++ b/[core]/es_extended/client/main.lua @@ -91,6 +91,10 @@ AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin) if Config.DisableWeaponWheel or Config.DisableAimAssist or Config.DisableVehicleRewards then CreateThread(function() while true do + if Config.DisableDisplayAmmo then + DisplayAmmoThisFrame(false) + end + if Config.DisableWeaponWheel then BlockWeaponWheelThisFrame() DisableControlAction(0, 37, true) diff --git a/[core]/es_extended/config.lua b/[core]/es_extended/config.lua index d41ee683..574876b3 100644 --- a/[core]/es_extended/config.lua +++ b/[core]/es_extended/config.lua @@ -58,6 +58,7 @@ Config.DisableScenarios = false -- Disable Scenarios Config.DisableWeaponWheel = false -- Disables default weapon wheel Config.DisableAimAssist = false -- disables AIM assist (mainly on controllers) Config.DisableVehicleSeatShuff = false -- Disables vehicle seat shuff +Config.DisableDisplayAmmo = false -- Disable ammunition display Config.RemoveHudComponents = { [1] = false, --WANTED_STARS, [2] = false, --WEAPON_ICON From d755a57e8fef2b4f24871b5ff306472d0c3d296c Mon Sep 17 00:00:00 2001 From: Arctos2win <116841243+Arctos2win@users.noreply.github.com> Date: Fri, 1 Sep 2023 17:58:06 +0200 Subject: [PATCH 2/6] Improve the way the identifier is fetched --- [core]/esx_multicharacter/server/main.lua | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/[core]/esx_multicharacter/server/main.lua b/[core]/esx_multicharacter/server/main.lua index 15058c75..b55704cb 100644 --- a/[core]/esx_multicharacter/server/main.lua +++ b/[core]/esx_multicharacter/server/main.lua @@ -31,17 +31,13 @@ local PREFIX = Config.Prefix or 'char' local PRIMARY_IDENTIFIER = ESX.GetConfig().Identifier or GetConvar('sv_lan', '') == 'true' and 'ip' or "license" local function GetIdentifier(source) - local fxDk = GetConvarInt('sv_fxdkMode', 0) - if fxDk == 1 then - return "ESX-DEBUG-LICENCE" - end - local identifier = PRIMARY_IDENTIFIER..':' - for _, v in pairs(GetPlayerIdentifiers(source)) do - if string.match(v, identifier) then - identifier = string.gsub(v, identifier, '') - return identifier - end - end + local fxDk = GetConvarInt('sv_fxdkMode', 0) + if fxDk == 1 then + return "ESX-DEBUG-LICENCE" + end + + local identifier = string.gsub(GetPlayerIdentifierByType(source, PRIMARY_IDENTIFIER), PRIMARY_IDENTIFIER .. ':', '') + return identifier end if next(ESX.Players) then From 7978485b7a6201ca83b2196605abded15dac7f27 Mon Sep 17 00:00:00 2001 From: Arctos2win <116841243+Arctos2win@users.noreply.github.com> Date: Sat, 2 Sep 2023 13:42:25 +0200 Subject: [PATCH 3/6] update to requested changes --- [core]/esx_multicharacter/server/main.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/[core]/esx_multicharacter/server/main.lua b/[core]/esx_multicharacter/server/main.lua index b55704cb..97c18421 100644 --- a/[core]/esx_multicharacter/server/main.lua +++ b/[core]/esx_multicharacter/server/main.lua @@ -36,8 +36,14 @@ local function GetIdentifier(source) return "ESX-DEBUG-LICENCE" end - local identifier = string.gsub(GetPlayerIdentifierByType(source, PRIMARY_IDENTIFIER), PRIMARY_IDENTIFIER .. ':', '') - return identifier + local identifier = GetPlayerIdentifierByType(source, PRIMARY_IDENTIFIER) + + if not identifier then + return + end + + identifier = identifier:gsub(PRIMARY_IDENTIFIER .. ':', '') + return identifier end if next(ESX.Players) then From 87e94c8193b471ff01b981e12ed39bbe0eeaba47 Mon Sep 17 00:00:00 2001 From: Arctos2win <116841243+Arctos2win@users.noreply.github.com> Date: Sat, 2 Sep 2023 15:48:25 +0200 Subject: [PATCH 4/6] update little thing --- [core]/esx_multicharacter/server/main.lua | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/[core]/esx_multicharacter/server/main.lua b/[core]/esx_multicharacter/server/main.lua index 97c18421..5e83f637 100644 --- a/[core]/esx_multicharacter/server/main.lua +++ b/[core]/esx_multicharacter/server/main.lua @@ -37,13 +37,7 @@ local function GetIdentifier(source) end local identifier = GetPlayerIdentifierByType(source, PRIMARY_IDENTIFIER) - - if not identifier then - return - end - - identifier = identifier:gsub(PRIMARY_IDENTIFIER .. ':', '') - return identifier + return identifier and identifier:gsub(PRIMARY_IDENTIFIER .. ':', '') end if next(ESX.Players) then From 45c4b666082dc77d42365750a613f2c847a94c1e Mon Sep 17 00:00:00 2001 From: Arctos2win <116841243+Arctos2win@users.noreply.github.com> Date: Sun, 3 Sep 2023 11:20:57 +0200 Subject: [PATCH 5/6] improve fetching identifier in es_extended ( same way as in multichar ) --- [core]/es_extended/server/functions.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/[core]/es_extended/server/functions.lua b/[core]/es_extended/server/functions.lua index 5284362b..91586005 100644 --- a/[core]/es_extended/server/functions.lua +++ b/[core]/es_extended/server/functions.lua @@ -287,12 +287,9 @@ function ESX.GetIdentifier(playerId) if fxDk == 1 then return "ESX-DEBUG-LICENCE" end - for _, v in ipairs(GetPlayerIdentifiers(playerId)) do - if string.match(v, 'license:') then - local identifier = string.gsub(v, 'license:', '') - return identifier - end - end + + local identifier = GetPlayerIdentifierByType(playerId, 'license') + return identifier and identifier:gsub('license:', '') end ---@param model string|number From 0bb956414b0c5183b46a1156bc8af6e80e0e59c0 Mon Sep 17 00:00:00 2001 From: Thekuca <63980591+Thekuca@users.noreply.github.com> Date: Sun, 3 Sep 2023 15:30:50 +0200 Subject: [PATCH 6/6] feat(classes/player): added an admin flag inside the obj for easier check --- [core]/es_extended/server/classes/player.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/[core]/es_extended/server/classes/player.lua b/[core]/es_extended/server/classes/player.lua index 307b5e95..49b600cf 100644 --- a/[core]/es_extended/server/classes/player.lua +++ b/[core]/es_extended/server/classes/player.lua @@ -20,6 +20,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, self.weight = weight self.maxWeight = Config.MaxWeight self.metadata = metadata + self.admin = Core.IsPlayerAdmin(playerId) if Config.Multichar then self.license = 'license' .. identifier:sub(identifier:find(':'), identifier:len()) else self.license = 'license:' .. identifier end ExecuteCommand(('add_principal identifier.%s group.%s'):format(self.license, self.group))