From fa7799532f0da75f40620490b9e92c41dacdf6d2 Mon Sep 17 00:00:00 2001 From: Kasey FItton Date: Fri, 8 Nov 2024 06:46:21 +0000 Subject: [PATCH] tweak(es_extended): move PvP and wanted level to adjustments --- [core]/es_extended/client/main.lua | 96 +------------------ .../client/modules/adjustments.lua | 8 ++ .../es_extended/shared/config/adjustments.lua | 3 +- [core]/es_extended/shared/config/main.lua | 3 +- 4 files changed, 12 insertions(+), 98 deletions(-) diff --git a/[core]/es_extended/client/main.lua b/[core]/es_extended/client/main.lua index c42ceea7..5792c05f 100644 --- a/[core]/es_extended/client/main.lua +++ b/[core]/es_extended/client/main.lua @@ -4,13 +4,6 @@ ESX.SecureNetEvent("esx:requestModel", function(model) ESX.Streaming.RequestModel(model) end) -local function EnablePvP() - if Config.EnablePVP then - SetCanAttackFriendly(ESX.PlayerData.ped, true, false) - NetworkSetFriendlyFireOption(true) - end -end - local function ApplyMetadata(metadata) if metadata.health then SetEntityHealth(ESX.PlayerData.ped, metadata.health) @@ -21,87 +14,6 @@ local function ApplyMetadata(metadata) end end -local function DisableNPCs() - -- Disable Dispatch services - if Config.DisableDispatchServices then - for i = 1, 15 do - EnableDispatchService(i, false) - end - SetAudioFlag('PoliceScannerDisabled', true) - end - - if Config.DisableScenarios then - local scenarios = { - "WORLD_VEHICLE_ATTRACTOR", - "WORLD_VEHICLE_AMBULANCE", - "WORLD_VEHICLE_BICYCLE_BMX", - "WORLD_VEHICLE_BICYCLE_BMX_BALLAS", - "WORLD_VEHICLE_BICYCLE_BMX_FAMILY", - "WORLD_VEHICLE_BICYCLE_BMX_HARMONY", - "WORLD_VEHICLE_BICYCLE_BMX_VAGOS", - "WORLD_VEHICLE_BICYCLE_MOUNTAIN", - "WORLD_VEHICLE_BICYCLE_ROAD", - "WORLD_VEHICLE_BIKE_OFF_ROAD_RACE", - "WORLD_VEHICLE_BIKER", - "WORLD_VEHICLE_BOAT_IDLE", - "WORLD_VEHICLE_BOAT_IDLE_ALAMO", - "WORLD_VEHICLE_BOAT_IDLE_MARQUIS", - "WORLD_VEHICLE_BOAT_IDLE_MARQUIS", - "WORLD_VEHICLE_BROKEN_DOWN", - "WORLD_VEHICLE_BUSINESSMEN", - "WORLD_VEHICLE_HELI_LIFEGUARD", - "WORLD_VEHICLE_CLUCKIN_BELL_TRAILER", - "WORLD_VEHICLE_CONSTRUCTION_SOLO", - "WORLD_VEHICLE_CONSTRUCTION_PASSENGERS", - "WORLD_VEHICLE_DRIVE_PASSENGERS", - "WORLD_VEHICLE_DRIVE_PASSENGERS_LIMITED", - "WORLD_VEHICLE_DRIVE_SOLO", - "WORLD_VEHICLE_FIRE_TRUCK", - "WORLD_VEHICLE_EMPTY", - "WORLD_VEHICLE_MARIACHI", - "WORLD_VEHICLE_MECHANIC", - "WORLD_VEHICLE_MILITARY_PLANES_BIG", - "WORLD_VEHICLE_MILITARY_PLANES_SMALL", - "WORLD_VEHICLE_PARK_PARALLEL", - "WORLD_VEHICLE_PARK_PERPENDICULAR_NOSE_IN", - "WORLD_VEHICLE_PASSENGER_EXIT", - "WORLD_VEHICLE_POLICE_BIKE", - "WORLD_VEHICLE_POLICE_CAR", - "WORLD_VEHICLE_POLICE", - "WORLD_VEHICLE_POLICE_NEXT_TO_CAR", - "WORLD_VEHICLE_QUARRY", - "WORLD_VEHICLE_SALTON", - "WORLD_VEHICLE_SALTON_DIRT_BIKE", - "WORLD_VEHICLE_SECURITY_CAR", - "WORLD_VEHICLE_STREETRACE", - "WORLD_VEHICLE_TOURBUS", - "WORLD_VEHICLE_TOURIST", - "WORLD_VEHICLE_TANDL", - "WORLD_VEHICLE_TRACTOR", - "WORLD_VEHICLE_TRACTOR_BEACH", - "WORLD_VEHICLE_TRUCK_LOGS", - "WORLD_VEHICLE_TRUCKS_TRAILERS", - "WORLD_VEHICLE_DISTANT_EMPTY_GROUND", - "WORLD_HUMAN_PAPARAZZI", - } - - for _, v in pairs(scenarios) do - SetScenarioTypeEnabled(v, false) - end - end -end - -local function DisableAmmoOrVehicleRewards(playerId) - -end - -local function ApplyConfig() - -- RemoveHudComponents - - EnablePvP() - DisableNPCs() -end - ESX.SecureNetEvent("esx:playerLoaded", function(xPlayer, _, skin) ESX.PlayerData = xPlayer @@ -142,7 +54,7 @@ ESX.SecureNetEvent("esx:playerLoaded", function(xPlayer, _, skin) end Actions:Init() - SetDefaultVehicleNumberPlateTextPattern(-1, Config.CustomAIPlates) + StartServerSyncLoops() end) @@ -404,12 +316,6 @@ if not Config.CustomInventory and Config.EnableDefaultInventory then end) end --- disable wanted level -if not Config.EnableWantedLevel then - ClearPlayerWantedLevel(ESX.playerId) - SetMaxWantedLevel(0) -end - if not Config.CustomInventory then CreateThread(function() while true do diff --git a/[core]/es_extended/client/modules/adjustments.lua b/[core]/es_extended/client/modules/adjustments.lua index a19995fc..37057b30 100644 --- a/[core]/es_extended/client/modules/adjustments.lua +++ b/[core]/es_extended/client/modules/adjustments.lua @@ -208,6 +208,13 @@ function Adjustments:DiscordPresence() end end +function Adjustments:WantedLevel() + if not Config.EnableWantedLevel then + ClearPlayerWantedLevel(ESX.playerId) + SetMaxWantedLevel(0) + end +end + function Adjustments:Load() self:RemoveHudComponents() self:DisableAimAssist() @@ -220,4 +227,5 @@ function Adjustments:Load() self:NPCScenarios() self:LicensePlates() self:DiscordPresence() + self:WantedLevel() end diff --git a/[core]/es_extended/shared/config/adjustments.lua b/[core]/es_extended/shared/config/adjustments.lua index 5cb45fea..ae7b8a46 100644 --- a/[core]/es_extended/shared/config/adjustments.lua +++ b/[core]/es_extended/shared/config/adjustments.lua @@ -3,10 +3,11 @@ Config.DisableVehicleRewards = false -- Disables Player Receiving weapons from v Config.DisableNPCDrops = false -- stops NPCs from dropping weapons on death Config.DisableDispatchServices = true -- Disable Dispatch services Config.DisableScenarios = true -- 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.DisableDisplayAmmo = false -- Disable ammunition display +Config.EnablePVP = true -- Allow Player to player combat +Config.EnableWantedLevel = false -- Use Normal GTA wanted Level? Config.RemoveHudComponents = { [1] = false, --WANTED_STARS, diff --git a/[core]/es_extended/shared/config/main.lua b/[core]/es_extended/shared/config/main.lua index f6607790..e3e3dad2 100644 --- a/[core]/es_extended/shared/config/main.lua +++ b/[core]/es_extended/shared/config/main.lua @@ -40,8 +40,7 @@ Config.EnableSocietyPayouts = false -- pay from the society account that the pla Config.MaxWeight = 24 -- the max inventory weight without a backpack Config.PaycheckInterval = 7 * 60000 -- how often to receive paychecks in milliseconds Config.EnableDebug = false -- Use Debug options? -Config.EnableWantedLevel = false -- Use Normal GTA wanted Level? -Config.EnablePVP = true -- Allow Player to player combat + Config.DefaultJobDuty = true -- A players default duty status when changing jobs Config.Multichar = GetResourceState("esx_multicharacter") ~= "missing"