mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
Merge pull request #774 from TheFantomas/main
refactor(es_extended/client/main.lua): Remove unused variables and so…
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
local pickups = {}
|
local pickups = {}
|
||||||
local PlayerBank, PlayerMoney = 0,0
|
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
while not Config.Multichar do
|
while not Config.Multichar do
|
||||||
Wait(0)
|
Wait(0)
|
||||||
@@ -52,71 +52,71 @@ AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin)
|
|||||||
|
|
||||||
while ESX.PlayerData.ped == nil do Wait(20) end
|
while ESX.PlayerData.ped == nil do Wait(20) end
|
||||||
|
|
||||||
-- enable PVP
|
|
||||||
if Config.EnablePVP then
|
if Config.EnablePVP then
|
||||||
SetCanAttackFriendly(ESX.PlayerData.ped, true, false)
|
SetCanAttackFriendly(ESX.PlayerData.ped, true, false)
|
||||||
NetworkSetFriendlyFireOption(true)
|
NetworkSetFriendlyFireOption(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
local SetPlayerHealthRechargeMultiplier = SetPlayerHealthRechargeMultiplier
|
local SetPlayerHealthRechargeMultiplier = SetPlayerHealthRechargeMultiplier
|
||||||
local BlockWeaponWheelThisFrame = BlockWeaponWheelThisFrame
|
local BlockWeaponWheelThisFrame = BlockWeaponWheelThisFrame
|
||||||
local DisableControlAction = DisableControlAction
|
local DisableControlAction = DisableControlAction
|
||||||
local IsPedArmed = IsPedArmed
|
local IsPedArmed = IsPedArmed
|
||||||
local SetPlayerLockonRangeOverride = SetPlayerLockonRangeOverride
|
local SetPlayerLockonRangeOverride = SetPlayerLockonRangeOverride
|
||||||
local DisablePlayerVehicleRewards = DisablePlayerVehicleRewards
|
local DisablePlayerVehicleRewards = DisablePlayerVehicleRewards
|
||||||
local RemoveAllPickupsOfType = RemoveAllPickupsOfType
|
local RemoveAllPickupsOfType = RemoveAllPickupsOfType
|
||||||
local HideHudComponentThisFrame = HideHudComponentThisFrame
|
local HideHudComponentThisFrame = HideHudComponentThisFrame
|
||||||
local PlayerId = PlayerId()
|
local PlayerId = PlayerId()
|
||||||
local DisabledComps = {}
|
local DisabledComps = {}
|
||||||
for i=1, #(Config.RemoveHudCommonents) do
|
for i=1, #(Config.RemoveHudCommonents) do
|
||||||
if Config.RemoveHudCommonents[i] then
|
if Config.RemoveHudCommonents[i] then
|
||||||
DisabledComps[#DisabledComps + 1] = i
|
DisabledComps[#DisabledComps + 1] = i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
while true do
|
|
||||||
local Sleep = true
|
|
||||||
|
|
||||||
if Config.DisableHealthRegeneration then
|
while true do
|
||||||
Sleep = false
|
local Sleep = true
|
||||||
SetPlayerHealthRechargeMultiplier(PlayerId, 0.0)
|
|
||||||
end
|
|
||||||
|
|
||||||
if Config.DisableWeaponWheel then
|
if Config.DisableHealthRegeneration then
|
||||||
Sleep = false
|
Sleep = false
|
||||||
BlockWeaponWheelThisFrame()
|
SetPlayerHealthRechargeMultiplier(PlayerId, 0.0)
|
||||||
DisableControlAction(0, 37,true)
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if Config.DisableAimAssist then
|
if Config.DisableWeaponWheel then
|
||||||
Sleep = false
|
Sleep = false
|
||||||
if IsPedArmed(ESX.PlayerData.ped, 4) then
|
BlockWeaponWheelThisFrame()
|
||||||
SetPlayerLockonRangeOverride(PlayerId, 2.0)
|
DisableControlAction(0, 37,true)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if Config.DisableVehicleRewards then
|
if Config.DisableAimAssist then
|
||||||
Sleep = false
|
Sleep = false
|
||||||
DisablePlayerVehicleRewards(PlayerId)
|
if IsPedArmed(ESX.PlayerData.ped, 4) then
|
||||||
|
SetPlayerLockonRangeOverride(PlayerId, 2.0)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if Config.DisableVehicleRewards then
|
||||||
|
Sleep = false
|
||||||
|
DisablePlayerVehicleRewards(PlayerId)
|
||||||
|
end
|
||||||
|
|
||||||
if Config.DisableNPCDrops then
|
if Config.DisableNPCDrops then
|
||||||
Sleep = false
|
Sleep = false
|
||||||
RemoveAllPickupsOfType(0xDF711959) -- carbine rifle
|
RemoveAllPickupsOfType(0xDF711959)
|
||||||
RemoveAllPickupsOfType(0xF9AFB48F) -- pistol
|
RemoveAllPickupsOfType(0xF9AFB48F)
|
||||||
RemoveAllPickupsOfType(0xA9355DCD) -- pumpshotgun
|
RemoveAllPickupsOfType(0xA9355DCD)
|
||||||
end
|
end
|
||||||
|
|
||||||
if #DisabledComps > 0 then
|
if #DisabledComps > 0 then
|
||||||
Sleep = false
|
Sleep = false
|
||||||
for i=1, #(DisabledComps) do
|
for i=1, #(DisabledComps) do
|
||||||
HideHudComponentThisFrame(DisabledComps[i])
|
HideHudComponentThisFrame(DisabledComps[i])
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
Wait(Sleep and 1500 or 0)
|
Wait(Sleep and 1500 or 0)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if Config.EnableHud then
|
if Config.EnableHud then
|
||||||
for i=1, #(ESX.PlayerData.accounts) do
|
for i=1, #(ESX.PlayerData.accounts) do
|
||||||
|
|||||||
Reference in New Issue
Block a user