From 69342a678b896395280d2a573c4e1ee2eb851c74 Mon Sep 17 00:00:00 2001 From: Mycroft Date: Wed, 21 Sep 2022 18:33:00 +0100 Subject: [PATCH] fix(es_extended): Gamebuild now returns for all users --- [esx]/es_extended/config.weapons.lua | 38 ++++++++++++++++++++++++---- [esx]/es_extended/server/main.lua | 4 +++ 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/[esx]/es_extended/config.weapons.lua b/[esx]/es_extended/config.weapons.lua index 55944bd5..74d8dcc7 100644 --- a/[esx]/es_extended/config.weapons.lua +++ b/[esx]/es_extended/config.weapons.lua @@ -963,10 +963,37 @@ Config.Weapons = { {name = 'WEAPON_DIGISCANNER', label = _U('weapon_digiscanner'), components = {}}, {name = 'GADGET_PARACHUTE', label = _U('gadget_parachute'), components = {}} } - - local GameBuild = tonumber(GetConvar("sv_enforceGameBuild", 1604)) - - -- The Criminal Enterprises DLC Weapons +if not IsDuplicityVersion() then + ESX.TriggerServerCallback('esx:getGameBuild', function(GameBuild) + if GameBuild >= 2699 then + local Length = #Config.Weapons + Config.Weapons[Length + 1] = { + name = 'WEAPON_TACTICALRIFLE', + label = _U('weapon_tactilerifle'), + ammo = {label = _U('ammo_rounds'), hash = `AMMO_RIFLE`}, + tints = Config.DefaultWeaponTints, + components = { + {name = 'clip_default', label = _U('component_clip_default'), hash = `COMPONENT_TACTICALRIFLE_CLIP_01`}, + {name = 'clip_extended', label = _U('component_clip_extended'), hash = `COMPONENT_TACTICALRIFLE_CLIP_02`}, + {name = 'flashlight', label = _U('component_flashlight'), hash = `COMPONENT_AT_AR_FLSH_REH`}, + {name = 'grip', label = _U('component_grip'), hash = `COMPONENT_AT_AR_AFGRIP`}, + {name = 'suppressor', label = _U('component_suppressor'), hash = `COMPONENT_AT_AR_SUPP_02`} + } + } + Config.Weapons[Length + 2] = { + name = 'WEAPON_PRECISIONRIFLE', + label = _U('weapon_precisionrifle'), + ammo = {label = _U('ammo_rounds'), hash = `AMMO_SNIPER`}, + tints = Config.DefaultWeaponTints, + components = { + {name = 'clip_default', label = _U('component_clip_default'), hash = `COMPONENT_PRECISIONRIFLE_CLIP_01`}, + } + } + Config.Weapons[Length+ 3] = {name = 'WEAPON_METALDETECTOR', label = _U('weapon_metaldetector'), components = {}} + end + end) +else + local GameBuild = tonumber(GetConvar("sv_enforceGameBuild", 1604)) if GameBuild >= 2699 then local Length = #Config.Weapons Config.Weapons[Length + 1] = { @@ -992,4 +1019,5 @@ Config.Weapons = { } } Config.Weapons[Length+ 3] = {name = 'WEAPON_METALDETECTOR', label = _U('weapon_metaldetector'), components = {}} - end \ No newline at end of file + end +end \ No newline at end of file diff --git a/[esx]/es_extended/server/main.lua b/[esx]/es_extended/server/main.lua index 16f2c26a..9851c2d6 100644 --- a/[esx]/es_extended/server/main.lua +++ b/[esx]/es_extended/server/main.lua @@ -595,6 +595,10 @@ ESX.RegisterServerCallback('esx:isUserAdmin', function(source, cb) cb(Core.IsPlayerAdmin(source)) end) +ESX.RegisterServerCallback('esx:getGameBuild', function(source, cb) + cb(tonumber(GetConvar("sv_enforceGameBuild", 1604))) +end) + ESX.RegisterServerCallback('esx:getOtherPlayerData', function(source, cb, target) local xPlayer = ESX.GetPlayerFromId(target)