refactor(es_extended): better config performance

This commit is contained in:
Mycroft
2022-08-31 15:17:01 +01:00
parent 7b3cd15254
commit 93bcc8fbdb
2 changed files with 26 additions and 14 deletions
+17 -5
View File
@@ -65,41 +65,53 @@ AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin)
local RemoveAllPickupsOfType = RemoveAllPickupsOfType
local HideHudComponentThisFrame = HideHudComponentThisFrame
local PlayerId = PlayerId()
local DisabledComps = {}
for i=1, #(Config.RemoveHudCommonents) do
if Config.RemoveHudCommonents[i] then
DisabledComps[#DisabledComps + 1] = i
end
end
while true do
Wait(0)
local Sleep = true
if Config.DisableHealthRegeneration then
Sleep = false
SetPlayerHealthRechargeMultiplier(PlayerId, 0.0)
end
if Config.DisableWeaponWheel then
Sleep = false
BlockWeaponWheelThisFrame()
DisableControlAction(0, 37,true)
end
if Config.DisableAimAssist then
Sleep = false
if IsPedArmed(ESX.PlayerData.ped, 4) then
SetPlayerLockonRangeOverride(PlayerId, 2.0)
end
end
if Config.DisableVehicleRewards then
Sleep = false
DisablePlayerVehicleRewards(PlayerId)
end
if Config.DisableNPCDrops then
Sleep = false
RemoveAllPickupsOfType(0xDF711959) -- carbine rifle
RemoveAllPickupsOfType(0xF9AFB48F) -- pistol
RemoveAllPickupsOfType(0xA9355DCD) -- pumpshotgun
end
if Config.RemoveHudCommonents then
for i=1, #(Config.RemoveHudCommonents) do
if Config.RemoveHudCommonents[i] then
if #DisabledComps > 0 then
Sleep = false
for i=1, #(DisabledComps) do
HideHudComponentThisFrame(i)
end
end
end
Wait(Sleep and 1500 or 0)
end
end)
+9 -9
View File
@@ -32,28 +32,28 @@ Config.Multichar = true -- Enable support for esx_multicharacter
Config.Identity = true -- Select a characters identity data before they have loaded in (this happens by default with multichar)
Config.DistanceGive = 4.0 -- Max distance when giving items, weapons etc.
Config.DisableHealthRegen = false -- Player will no longer regenerate health
Config.DisableVehicleRewards = true -- Disables Player Recieving weapons from vehicles
Config.DisableNPCDrops = true -- stops NPCs from dropping weapons on death
Config.DisableVehicleRewards = false -- Disables Player Recieving weapons from vehicles
Config.DisableNPCDrops = false -- stops NPCs from dropping weapons on death
Config.DisableWeaponWheel = false -- Disables default weapon wheel
Config.DisableAimAssist = true -- disables AIM assist (mainly on controllers)
Config.DisableAimAssist = false -- disables AIM assist (mainly on controllers)
Config.RemoveHudCommonents = {
[1] = true, --WANTED_STARS,
[1] = false, --WANTED_STARS,
[2] = false, --WEAPON_ICON
[3] = true, --CASH
[4] = true, --MP_CASH
[3] = false, --CASH
[4] = false, --MP_CASH
[5] = false, --MP_MESSAGE
[6] = false, --VEHICLE_NAME
[7] = false,-- AREA_NAME
[8] = true,-- VEHICLE_CLASS
[8] = false,-- VEHICLE_CLASS
[9] = false, --STREET_NAME
[10] = false, --HELP_TEXT
[11] = false, --FLOATING_HELP_TEXT_1
[12] = false, --FLOATING_HELP_TEXT_2
[13] = true, --CASH_CHANGE
[13] = false, --CASH_CHANGE
[14] = false, --RETICLE
[15] = false, --SUBTITLE_TEXT
[16] = false, --RADIO_STATIONS
[17] = true, --SAVING_GAME,
[17] = false, --SAVING_GAME,
[18] = false, --GAME_STREAM
[19] = false, --WEAPON_WHEEL
[20] = false, --WEAPON_WHEEL_STATS