From b429bf4c1bcbd3aea7f7141fe4d6411d50d6ab05 Mon Sep 17 00:00:00 2001 From: MoskalykA <100430077+MoskalykA@users.noreply.github.com> Date: Sun, 20 Aug 2023 18:46:45 +0200 Subject: [PATCH] refactor: disable action events --- [core]/es_extended/client/main.lua | 4 +++- [core]/es_extended/client/modules/actions.lua | 3 ++- [core]/es_extended/config.lua | 1 + [core]/es_extended/server/modules/actions.lua | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/[core]/es_extended/client/main.lua b/[core]/es_extended/client/main.lua index 3e38f3b26..3a6245913 100644 --- a/[core]/es_extended/client/main.lua +++ b/[core]/es_extended/client/main.lua @@ -75,13 +75,15 @@ AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin) end end - if Config.DisableVehicleSeatShuff then + if Config.DisableVehicleSeatShuff and not Config.DisableActions then AddEventHandler('esx:enteredVehicle', function(vehicle, _, seat) if seat == 0 then SetPedIntoVehicle(ESX.PlayerData.ped, vehicle, 0) SetPedConfigFlag(ESX.PlayerData.ped, 184, true) end end) + elseif Config.DisableActions then + print("[^3WARNING^7] The ^5DisableVehicleSeatShuff^7 option cannot be enabled because the ^5DisableActions^7 option is enabled") end if Config.DisableHealthRegeneration then diff --git a/[core]/es_extended/client/modules/actions.lua b/[core]/es_extended/client/modules/actions.lua index 219c35082..638671f98 100644 --- a/[core]/es_extended/client/modules/actions.lua +++ b/[core]/es_extended/client/modules/actions.lua @@ -1,3 +1,5 @@ +if Config.DisableActions then return end + local isInVehicle, isEnteringVehicle, isJumping, inPauseMenu = false, false, false, false local playerPed = PlayerPedId() local current = {} @@ -44,7 +46,6 @@ CreateThread(function() TriggerEvent('esx:pauseMenuActive', inPauseMenu) end - if not isInVehicle and not IsPlayerDead(PlayerId()) then if DoesEntityExist(GetVehiclePedIsTryingToEnter(playerPed)) and not isEnteringVehicle then -- trying to enter a vehicle! diff --git a/[core]/es_extended/config.lua b/[core]/es_extended/config.lua index d41ee683b..2210efaf1 100644 --- a/[core]/es_extended/config.lua +++ b/[core]/es_extended/config.lua @@ -58,6 +58,7 @@ Config.DisableScenarios = false -- Disable Scenarios Config.DisableWeaponWheel = false -- Disables default weapon wheel Config.DisableAimAssist = false -- disables AIM assist (mainly on controllers) Config.DisableVehicleSeatShuff = false -- Disables vehicle seat shuff +Config.DisableActions = false -- Disable events based on certain actions (ped change, jump, vehicle) Config.RemoveHudComponents = { [1] = false, --WANTED_STARS, [2] = false, --WEAPON_ICON diff --git a/[core]/es_extended/server/modules/actions.lua b/[core]/es_extended/server/modules/actions.lua index c05131268..5090e42b8 100644 --- a/[core]/es_extended/server/modules/actions.lua +++ b/[core]/es_extended/server/modules/actions.lua @@ -1,3 +1,5 @@ +if Config.DisableActions then return end + RegisterServerEvent('esx:playerPedChanged') RegisterServerEvent('esx:playerJumping') RegisterServerEvent('esx:enteringVehicle')