fix config options, remove un-needed event

This commit is contained in:
Mycroft
2022-08-07 09:44:06 +01:00
parent 24fc76097d
commit a985ad3716
+12 -54
View File
@@ -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()