Skip to content

Commit

Permalink
refactor: disable action events
Browse files Browse the repository at this point in the history
  • Loading branch information
MoskalykA committed Aug 20, 2023
1 parent eb91ec7 commit b429bf4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion [core]/es_extended/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion [core]/es_extended/client/modules/actions.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
if Config.DisableActions then return end

local isInVehicle, isEnteringVehicle, isJumping, inPauseMenu = false, false, false, false
local playerPed = PlayerPedId()
local current = {}
Expand Down Expand Up @@ -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!
Expand Down
1 change: 1 addition & 0 deletions [core]/es_extended/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions [core]/es_extended/server/modules/actions.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
if Config.DisableActions then return end

RegisterServerEvent('esx:playerPedChanged')
RegisterServerEvent('esx:playerJumping')
RegisterServerEvent('esx:enteringVehicle')
Expand Down

0 comments on commit b429bf4

Please sign in to comment.