From a985ad37160076d0903829c3e4e5f9bc8c023ad7 Mon Sep 17 00:00:00 2001 From: Mycroft Date: Sun, 7 Aug 2022 09:44:06 +0100 Subject: [PATCH] fix config options, remove un-needed event --- [esx]/es_extended/client/main.lua | 66 ++++++------------------------- 1 file changed, 12 insertions(+), 54 deletions(-) diff --git a/[esx]/es_extended/client/main.lua b/[esx]/es_extended/client/main.lua index e12a820b..08d8e0cc 100644 --- a/[esx]/es_extended/client/main.lua +++ b/[esx]/es_extended/client/main.lua @@ -55,46 +55,41 @@ AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin) NetworkSetFriendlyFireOption(true) end - if Config.DisableVehicleRewards then - DisablePlayerVehicleRewards(PlayerId()) - end - - if Config.DisableNPCDrops then - RemoveAllPickupsOfType(0xDF711959) -- carbine rifle - RemoveAllPickupsOfType(0xF9AFB48F) -- pistol - RemoveAllPickupsOfType(0xA9355DCD) -- pumpshotgun - end - CreateThread(function() while true do - local Sleep = 1500 - + Wait(0) if Config.DisableHealthRegeneration then SetPlayerHealthRechargeMultiplier(PlayerId(), 0.0) end if Config.DisableWeaponWheel then - Sleep = 0 BlockWeaponWheelThisFrame() DisableControlAction(0, 37,true) end if Config.DisableAimAssist then - if Sleep == 1500 then Sleep = 100 end if IsPedArmed(ESX.PlayerData.ped, 4) then SetPlayerLockonRangeOverride(PlayerId(), 2.0) end end + if Config.DisableVehicleRewards then + DisablePlayerVehicleRewards(PlayerId()) + end + + if Config.DisableNPCDrops then + RemoveAllPickupsOfType(0xDF711959) -- carbine rifle + RemoveAllPickupsOfType(0xF9AFB48F) -- pistol + RemoveAllPickupsOfType(0xA9355DCD) -- pumpshotgun + end + if Config.RemoveHudCommonents then - if Sleep ~= 0 then Sleep = 0 end for i=1, #(Config.RemoveHudCommonents) do if Config.RemoveHudCommonents[i] then HideHudComponentThisFrame(i) end end end - Wait(Sleep) end end) @@ -115,6 +110,7 @@ AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin) }) end + SetDefaultVehicleNumberPlateTextPattern(-1, 'ESX.A111') FreezeEntityPosition(PlayerPedId(), false) StartServerSyncLoops() end) @@ -395,44 +391,6 @@ if not Config.OxInventory then end) end -RegisterNetEvent('esx:deleteVehicle') -AddEventHandler('esx:deleteVehicle', function(radius) - if radius and tonumber(radius) then - radius = tonumber(radius) + 0.01 - local vehicles = ESX.Game.GetVehiclesInArea(GetEntityCoords(ESX.PlayerData.ped), radius) - - for k,entity in ipairs(vehicles) do - local attempt = 0 - - while not NetworkHasControlOfEntity(entity) and attempt < 100 and DoesEntityExist(entity) do - Wait(100) - NetworkRequestControlOfEntity(entity) - attempt = attempt + 1 - end - - if DoesEntityExist(entity) and NetworkHasControlOfEntity(entity) then - ESX.Game.DeleteVehicle(entity) - end - end - else - local vehicle, attempt = ESX.Game.GetVehicleInDirection(), 0 - - if IsPedInAnyVehicle(ESX.PlayerData.ped, true) then - vehicle = GetVehiclePedIsIn(ESX.PlayerData.ped, false) - end - - while not NetworkHasControlOfEntity(vehicle) and attempt < 100 and DoesEntityExist(vehicle) do - Wait(100) - NetworkRequestControlOfEntity(vehicle) - attempt = attempt + 1 - end - - if DoesEntityExist(vehicle) and NetworkHasControlOfEntity(vehicle) then - ESX.Game.DeleteVehicle(vehicle) - end - end -end) - -- Pause menu disables HUD display if Config.EnableHud then CreateThread(function()