Skip to content

Commit

Permalink
chore: es_extended code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Jun 6, 2024
1 parent 0b6cc1d commit 7d0782b
Show file tree
Hide file tree
Showing 27 changed files with 938 additions and 824 deletions.
3 changes: 2 additions & 1 deletion server-data/resources/[esx]/es_extended/client/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ end)

AddEventHandler("esx:getSharedObject", function()
local Invoke = GetInvokingResource()
print(("[^1ERROR^7] Resource ^5%s^7 Used the ^5getSharedObject^7 Event, this event ^1no longer exists!^7 Visit https://bitpredator.github.io/bptdevelopment/docs/esx-tutorial/sharedevent for how to fix!"):format(Invoke))
print(("[^1ERROR^7] Resource ^5%s^7 Used the ^5getSharedObject^7 Event, this event ^1no longer exists!^7 Visit https://bitpredator.github.io/bptdevelopment/docs/esx-tutorial/sharedevent for how to fix!")
:format(Invoke))
end)
139 changes: 77 additions & 62 deletions server-data/resources/[esx]/es_extended/client/functions.lua

Large diffs are not rendered by default.

22 changes: 15 additions & 7 deletions server-data/resources/[esx]/es_extended/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ if not Config.OxInventory then
RegisterNetEvent("esx:removeInventoryItem", function(item, count, showNotification)
for i = 1, #ESX.PlayerData.inventory do
if ESX.PlayerData.inventory[i].name == item then
ESX.UI.ShowInventoryItemNotification(false, ESX.PlayerData.inventory[i].label, ESX.PlayerData.inventory[i].count - count)
ESX.UI.ShowInventoryItemNotification(false, ESX.PlayerData.inventory[i].label,
ESX.PlayerData.inventory[i].count - count)
ESX.PlayerData.inventory[i].count = count
break
end
Expand All @@ -325,11 +326,13 @@ if not Config.OxInventory then
end)

RegisterNetEvent("esx:addWeaponComponent", function()
print("[^1ERROR^7] event ^5'esx:addWeaponComponent'^7 Has Been Removed. Please use ^5xPlayer.addWeaponComponent^7 Instead!")
print(
"[^1ERROR^7] event ^5'esx:addWeaponComponent'^7 Has Been Removed. Please use ^5xPlayer.addWeaponComponent^7 Instead!")
end)

RegisterNetEvent("esx:setWeaponAmmo", function()
print("[^1ERROR^7] event ^5'esx:setWeaponAmmo'^7 Has Been Removed. Please use ^5xPlayer.addWeaponAmmo^7 Instead!")
print(
"[^1ERROR^7] event ^5'esx:setWeaponAmmo'^7 Has Been Removed. Please use ^5xPlayer.addWeaponAmmo^7 Instead!")
end)

RegisterNetEvent("esx:setWeaponTint", function(weapon, weaponTintIndex)
Expand Down Expand Up @@ -385,15 +388,18 @@ if not Config.OxInventory then

RegisterNetEvent("esx:createMissingPickups", function(missingPickups)
for pickupId, pickup in pairs(missingPickups) do
TriggerEvent("esx:createPickup", pickupId, pickup.label, vector3(pickup.coords.x, pickup.coords.y, pickup.coords.z - 1.0), pickup.type, pickup.name, pickup.components, pickup.tintIndex)
TriggerEvent("esx:createPickup", pickupId, pickup.label,
vector3(pickup.coords.x, pickup.coords.y, pickup.coords.z - 1.0), pickup.type, pickup.name,
pickup.components, pickup.tintIndex)
end
end)
end

RegisterNetEvent("esx:registerSuggestions", function(registeredCommands)
for name, command in pairs(registeredCommands) do
if command.suggestion then
TriggerEvent("chat:addSuggestion", ("/%s"):format(name), command.suggestion.help, command.suggestion.arguments)
TriggerEvent("chat:addSuggestion", ("/%s"):format(name), command.suggestion.help,
command.suggestion.arguments)
end
end
end)
Expand Down Expand Up @@ -470,7 +476,8 @@ if not Config.OxInventory then
if IsPedOnFoot(ESX.PlayerData.ped) and (closestDistance == -1 or closestDistance > 3) and not pickup.inRange then
pickup.inRange = true

local dict, anim = "weapons@first_person@aim_rng@generic@projectile@sticky_bomb@", "plant_floor"
local dict, anim = "weapons@first_person@aim_rng@generic@projectile@sticky_bomb@",
"plant_floor"
ESX.Streaming.RequestAnimDict(dict)
TaskPlayAnim(ESX.PlayerData.ped, dict, anim, 8.0, 1.0, 1000, 16, 0.0, false, false, false)
RemoveAnimDict(dict)
Expand Down Expand Up @@ -637,7 +644,8 @@ RegisterNetEvent("esx:noclip", function()
CreateThread(noclipThread)
end

ESX.ShowNotification(TranslateCap("noclip_message", noclip and Translate("enabled") or Translate("disabled")), true, false, 140)
ESX.ShowNotification(TranslateCap("noclip_message", noclip and Translate("enabled") or Translate("disabled")),
true, false, 140)
end)
end)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@ CreateThread(function()
current.seat = GetPedVehicleSeat(playerPed, current.vehicle)
current.plate = GetVehicleNumberPlateText(current.vehicle)
current.displayName, current.netId = GetData(current.vehicle)
TriggerEvent("esx:enteredVehicle", current.vehicle, current.plate, current.seat, current.displayName, current.netId)
TriggerEvent("esx:enteredVehicle", current.vehicle, current.plate, current.seat, current.displayName,
current.netId)
TriggerServerEvent("esx:enteredVehicle", current.plate, current.seat, current.displayName, current.netId)
end
elseif isInVehicle then
if not IsPedInAnyVehicle(playerPed, false) or IsPlayerDead(PlayerId()) then
-- bye, vehicle
TriggerEvent("esx:exitedVehicle", current.vehicle, current.plate, current.seat, current.displayName, current.netId)
TriggerEvent("esx:exitedVehicle", current.vehicle, current.plate, current.seat, current.displayName,
current.netId)
TriggerServerEvent("esx:exitedVehicle", current.plate, current.seat, current.displayName, current.netId)
isInVehicle = false
current = {}
Expand Down Expand Up @@ -111,10 +113,12 @@ if Config.EnableDebug then
end)

AddEventHandler("esx:enteredVehicle", function(vehicle, plate, seat, displayName, netId)
print("esx:enteredVehicle", "vehicle", vehicle, "plate", plate, "seat", seat, "displayName", displayName, "netId", netId)
print("esx:enteredVehicle", "vehicle", vehicle, "plate", plate, "seat", seat, "displayName", displayName, "netId",
netId)
end)

AddEventHandler("esx:exitedVehicle", function(vehicle, plate, seat, displayName, netId)
print("esx:exitedVehicle", "vehicle", vehicle, "plate", plate, "seat", seat, "displayName", displayName, "netId", netId)
print("esx:exitedVehicle", "vehicle", vehicle, "plate", plate, "seat", seat, "displayName", displayName, "netId",
netId)
end)
end
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ end

RegisterNetEvent("esx:serverCallback", function(requestId, invoker, ...)
if not serverRequests[requestId] then
return print(("[^1ERROR^7] Server Callback with requestId ^5%s^7 Was Called by ^5%s^7 but does not exist."):format(requestId, invoker))
return print(("[^1ERROR^7] Server Callback with requestId ^5%s^7 Was Called by ^5%s^7 but does not exist.")
:format(requestId, invoker))
end

serverRequests[requestId](...)
Expand All @@ -31,7 +32,8 @@ end

RegisterNetEvent("esx:triggerClientCallback", function(eventName, requestId, invoker, ...)
if not clientCallbacks[eventName] then
return print(("[^1ERROR^7] Client Callback not registered, name: ^5%s^7, invoker resource: ^5%s^7"):format(eventName, invoker))
return print(("[^1ERROR^7] Client Callback not registered, name: ^5%s^7, invoker resource: ^5%s^7"):format(
eventName, invoker))
end

clientCallbacks[eventName](function(...)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ end
function ESX.Math.GroupDigits(value)
local left, num, right = string.match(value, "^([^%d]*%d)(%d*)(.-)$")

return left .. (num:reverse():gsub("(%d%d%d)", "%1" .. TranslateCap("locale_digit_grouping_symbol")):reverse()) .. right
return left ..
(num:reverse():gsub("(%d%d%d)", "%1" .. TranslateCap("locale_digit_grouping_symbol")):reverse()) .. right
end

function ESX.Math.Trim(value)
Expand Down
86 changes: 43 additions & 43 deletions server-data/resources/[esx]/es_extended/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Config.StartingAccountMoney = { bank = 50000 }

Config.StartingInventoryItems = false -- table/false

Config.DefaultSpawns = { -- If you want to have more spawn positions and select them randomly uncomment commented code or add more locations
Config.DefaultSpawns = { -- If you want to have more spawn positions and select them randomly uncomment commented code or add more locations
{ x = 222.2027, y = -864.0162, z = 30.2922, heading = 1.0 },
--{x = 224.9865, y = -865.0871, z = 30.2922, heading = 1.0},
--{x = 227.8436, y = -866.0400, z = 30.2922, heading = 1.0},
Expand All @@ -35,57 +35,57 @@ Config.AdminGroups = {
["admin"] = true,
}

Config.EnablePaycheck = true -- enable paycheck
Config.LogPaycheck = false -- Logs paychecks to a nominated Discord channel via webhook (default is false)
Config.EnableSocietyPayouts = false -- pay from the society account that the player is employed at? Requirement: esx_society
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.EnablePaycheck = true -- enable paycheck
Config.LogPaycheck = false -- Logs paychecks to a nominated Discord channel via webhook (default is false)
Config.EnableSocietyPayouts = false -- pay from the society account that the player is employed at? Requirement: esx_society
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.EnableDefaultInventory = true -- Display the default Inventory ( F2 )
Config.EnableWantedLevel = false -- Use Normal GTA wanted Level?
Config.EnablePVP = true -- Allow Player to player combat
Config.EnableWantedLevel = false -- Use Normal GTA wanted Level?
Config.EnablePVP = true -- Allow Player to player combat

Config.Multichar = GetResourceState("esx_multicharacter") ~= "missing"
Config.Identity = true -- Select a character identity data before they have loaded in (this happens by default with multichar)
Config.DistanceGive = 4.0 -- Max distance when giving items, weapons etc.
Config.Identity = true -- Select a character identity data before they have loaded in (this happens by default with multichar)
Config.DistanceGive = 4.0 -- Max distance when giving items, weapons etc.

Config.AdminLogging = false -- Logs the usage of certain commands by those with group.admin ace permissions (default is false)
Config.AdminLogging = false -- Logs the usage of certain commands by those with group.admin ace permissions (default is false)

Config.DisableHealthRegeneration = false -- Player will no longer regenerate health
Config.DisableVehicleRewards = false -- Disables Player Receiving weapons from vehicles
Config.DisableNPCDrops = false -- stops NPCs from dropping weapons on death
Config.DisableDispatchServices = false -- Disable Dispatch services
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.DisableDisplayAmmo = false -- Disable ammunition display
Config.DisableVehicleRewards = false -- Disables Player Receiving weapons from vehicles
Config.DisableNPCDrops = false -- stops NPCs from dropping weapons on death
Config.DisableDispatchServices = false -- Disable Dispatch services
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.DisableDisplayAmmo = false -- Disable ammunition display
Config.RemoveHudComponents = {
[1] = false, --WANTED_STARS,
[2] = false, --WEAPON_ICON
[3] = false, --CASH
[4] = false, --MP_CASH
[5] = false, --MP_MESSAGE
[6] = false, --VEHICLE_NAME
[7] = false, -- AREA_NAME
[8] = false, -- VEHICLE_CLASS
[9] = false, --STREET_NAME
[10] = false, --HELP_TEXT
[11] = false, --FLOATING_HELP_TEXT_1
[12] = false, --FLOATING_HELP_TEXT_2
[13] = false, --CASH_CHANGE
[14] = false, --RETICLE
[15] = false, --SUBTITLE_TEXT
[16] = false, --RADIO_STATIONS
[17] = false, --SAVING_GAME,
[18] = false, --GAME_STREAM
[19] = false, --WEAPON_WHEEL
[20] = false, --WEAPON_WHEEL_STATS
[21] = false, --HUD_COMPONENTS
[22] = false, --HUD_WEAPONS
[1] = false, --WANTED_STARS,
[2] = false, --WEAPON_ICON
[3] = false, --CASH
[4] = false, --MP_CASH
[5] = false, --MP_MESSAGE
[6] = false, --VEHICLE_NAME
[7] = false, -- AREA_NAME
[8] = false, -- VEHICLE_CLASS
[9] = false, --STREET_NAME
[10] = false, --HELP_TEXT
[11] = false, --FLOATING_HELP_TEXT_1
[12] = false, --FLOATING_HELP_TEXT_2
[13] = false, --CASH_CHANGE
[14] = false, --RETICLE
[15] = false, --SUBTITLE_TEXT
[16] = false, --RADIO_STATIONS
[17] = false, --SAVING_GAME,
[18] = false, --GAME_STREAM
[19] = false, --WEAPON_WHEEL
[20] = false, --WEAPON_WHEEL_STATS
[21] = false, --HUD_COMPONENTS
[22] = false, --HUD_WEAPONS
}

Config.SpawnVehMaxUpgrades = true -- admin vehicles spawn with max vehicle settings
Config.SpawnVehMaxUpgrades = true -- admin vehicles spawn with max vehicle settings
Config.CustomAIPlates = "........" -- Custom plates for AI vehicles
-- Pattern string format
--1 will lead to a random number from 0-9.
Expand Down
Loading

0 comments on commit 7d0782b

Please sign in to comment.