From 2ebaa422ea9718f0b757973bc13aa7a4ea43fe69 Mon Sep 17 00:00:00 2001 From: Kasey FItton Date: Tue, 15 Oct 2024 14:52:37 +0100 Subject: [PATCH 1/8] tweak: use txAdmin locale by default by default, use the txAdmin locale, unless a `esx:locale` is specified. This allows people to change languages easier, since everything will be in the same place, and if they want to specify a different language for ESX, then they can do. This also wont break anything, since it wont affect existing users whom will aready have the `esx:locale` set --- [core]/es_extended/config.lua | 6 +++++- server.cfg | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/[core]/es_extended/config.lua b/[core]/es_extended/config.lua index 3d82a1f00..a451a42dc 100644 --- a/[core]/es_extended/config.lua +++ b/[core]/es_extended/config.lua @@ -1,5 +1,9 @@ Config = {} -Config.Locale = GetConvar("esx:locale", "en") + +local txAdminLocale = GetConvar("txAdmin-locale", "en") +local esxLocale = GetConvar("esx:locale", "none") + +Config.Locale = esxLocale == "none" and txAdminLocale or esxLocale Config.OxInventory = GetResourceState("ox_inventory") ~= 'missing' diff --git a/server.cfg b/server.cfg index a4741dd0d..5eb2a3890 100644 --- a/server.cfg +++ b/server.cfg @@ -29,7 +29,9 @@ set onesync on # Enable OneSync [REQUIRED FOR LEGACY 1.7.5 +] set mysql_connection_string "mysql://user:password@localhost/es_extended?waitForConnections=true&charset=utf8mb4" set mysql_ui true -setr esx:locale "en" +## Umcomment to set your own locale, +## if not, it will use the language you have selected in txAdmin. +#setr esx:locale "en" ## These resources will start by default. ensure chat From 136c62bf776b69cfbaa2152f066336d4368bfafd Mon Sep 17 00:00:00 2001 From: Kasey FItton Date: Tue, 15 Oct 2024 15:39:36 +0100 Subject: [PATCH 2/8] twek(es_extended/config): account for txadminLocale being custom --- [core]/es_extended/config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/[core]/es_extended/config.lua b/[core]/es_extended/config.lua index a451a42dc..ffabbecb0 100644 --- a/[core]/es_extended/config.lua +++ b/[core]/es_extended/config.lua @@ -3,7 +3,7 @@ Config = {} local txAdminLocale = GetConvar("txAdmin-locale", "en") local esxLocale = GetConvar("esx:locale", "none") -Config.Locale = esxLocale == "none" and txAdminLocale or esxLocale +Config.Locale = (esxLocale == "none" and txAdminLocale ~= "custom") and txAdminLocale or esxLocale Config.OxInventory = GetResourceState("ox_inventory") ~= 'missing' From d077156c885e4f6dbd2a592ef8f10b477f3642ce Mon Sep 17 00:00:00 2001 From: Kasey FItton Date: Tue, 15 Oct 2024 15:40:58 +0100 Subject: [PATCH 3/8] tweak(es_extended/config): default to english --- [core]/es_extended/config.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/[core]/es_extended/config.lua b/[core]/es_extended/config.lua index ffabbecb0..a2a2e3107 100644 --- a/[core]/es_extended/config.lua +++ b/[core]/es_extended/config.lua @@ -3,7 +3,11 @@ Config = {} local txAdminLocale = GetConvar("txAdmin-locale", "en") local esxLocale = GetConvar("esx:locale", "none") -Config.Locale = (esxLocale == "none" and txAdminLocale ~= "custom") and txAdminLocale or esxLocale +if esxLocale == "none" then + Config.Locale = txAdminLocale ~= "custom" and txAdminLocale or "en" +else + Config.Locale = esxLocale +end Config.OxInventory = GetResourceState("ox_inventory") ~= 'missing' From f1b519807bf2ea32ea4e45578086d3f2f8e60aa2 Mon Sep 17 00:00:00 2001 From: Sergio <89666307+feelfreetofee@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:53:59 +0200 Subject: [PATCH 4/8] fix(es_extended/client/functions.lua): Fix typos Small fixes --- [core]/es_extended/client/functions.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/[core]/es_extended/client/functions.lua b/[core]/es_extended/client/functions.lua index 13ea8eae2..e80c9c770 100644 --- a/[core]/es_extended/client/functions.lua +++ b/[core]/es_extended/client/functions.lua @@ -321,7 +321,7 @@ function ESX.Game.Teleport(entity, coords, cb) end function ESX.Game.SpawnObject(object, coords, cb, networked) - local obj = CreateObject(ESX.Streaming.RequestModel(object), coords.x, coords.y. coords.z, networked == nil or networked, false, true) + local obj = CreateObject(ESX.Streaming.RequestModel(object), coords.x, coords.y, coords.z, networked == nil or networked, false, true) return cb and cb(obj) or obj end @@ -491,8 +491,9 @@ end function ESX.Game.RaycastScreen(depth, ...) local world, normal = GetWorldCoordFromScreenCoord(.5, .5) + local origin = world + normal local target = world + normal * depth - return target, ESX.Game.GetShapeTestResultAsync(StartShapeTestLosProbe(world + normal, target, ...)) + return target, ESX.Game.GetShapeTestResultSync(StartShapeTestLosProbe(origin.x, origin.y, origin.z, target.x, target.y, target.z, ...)) end function ESX.Game.GetClosestEntity(entities, isPlayerEntities, coords, modelFilter) From 8e170e07b2efe234e3719e0697830c86e1911cc2 Mon Sep 17 00:00:00 2001 From: Sergio <89666307+feelfreetofee@users.noreply.github.com> Date: Wed, 16 Oct 2024 00:42:51 +0200 Subject: [PATCH 5/8] fix(es_extended/client/functions.lua): on_release fix I was wrong #1411 --- [core]/es_extended/client/functions.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/[core]/es_extended/client/functions.lua b/[core]/es_extended/client/functions.lua index e80c9c770..79f56e265 100644 --- a/[core]/es_extended/client/functions.lua +++ b/[core]/es_extended/client/functions.lua @@ -140,12 +140,13 @@ function ESX.RefreshContext(...) end function ESX.RegisterInput(command_name, label, input_group, key, on_press, on_release) - RegisterCommand(on_release and '+' .. command_name or command_name, on_press) - Core.Input[command_name] = ESX.HashString(command_name) + local command = on_release and '+' .. command_name or command_name + RegisterCommand(command, on_press) + Core.Input[command_name] = ESX.HashString(command) if on_release then RegisterCommand('-' .. command_name, on_release) end - RegisterKeyMapping(command_name, label or '', input_group or 'keyboard', key or '') + RegisterKeyMapping(command, label or '', input_group or 'keyboard', key or '') end function ESX.UI.Menu.RegisterType(menuType, open, close) From 480d152f7648f6c93128a5f0ce7cbab2d04b10de Mon Sep 17 00:00:00 2001 From: Kasey FItton Date: Fri, 18 Oct 2024 07:58:52 +0100 Subject: [PATCH 6/8] tweak(es_extended/config): condense Config.Locale --- [core]/es_extended/config.lua | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/[core]/es_extended/config.lua b/[core]/es_extended/config.lua index a2a2e3107..95db96aff 100644 --- a/[core]/es_extended/config.lua +++ b/[core]/es_extended/config.lua @@ -1,13 +1,9 @@ Config = {} local txAdminLocale = GetConvar("txAdmin-locale", "en") -local esxLocale = GetConvar("esx:locale", "none") +local esxLocale = GetConvar("esx:locale", "invalid") -if esxLocale == "none" then - Config.Locale = txAdminLocale ~= "custom" and txAdminLocale or "en" -else - Config.Locale = esxLocale -end +Config.Locale = (esxLocale ~= "invalid") and esxLocale or (txAdminLocale ~= "custom" and txAdminLocale) or "en" Config.OxInventory = GetResourceState("ox_inventory") ~= 'missing' From a57759a115694c3563cdafe99dd20fc2ad28152c Mon Sep 17 00:00:00 2001 From: Kasey FItton Date: Fri, 18 Oct 2024 16:31:08 +0100 Subject: [PATCH 7/8] tweak(es_extended): use correct correct handling --- [core]/es_extended/client/common.lua | 2 +- [core]/es_extended/client/functions.lua | 4 +- [core]/es_extended/client/main.lua | 12 ++-- .../es_extended/client/modules/callback.lua | 4 +- [core]/es_extended/locale.lua | 2 +- [core]/es_extended/server/classes/player.lua | 56 +++++++++---------- [core]/es_extended/server/common.lua | 2 +- [core]/es_extended/server/main.lua | 6 +- .../es_extended/server/modules/callback.lua | 4 +- [core]/es_extended/server/onesync.lua | 4 +- 10 files changed, 48 insertions(+), 48 deletions(-) diff --git a/[core]/es_extended/client/common.lua b/[core]/es_extended/client/common.lua index 2191d17a2..e86221c3b 100644 --- a/[core]/es_extended/client/common.lua +++ b/[core]/es_extended/client/common.lua @@ -4,5 +4,5 @@ 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://documentation.esx-framework.org/tutorials/tutorials-esx/sharedevent for how to fix!"):format(Invoke)) + error(("Resource ^5%s^7 Used the ^5getSharedObject^7 Event, this event ^1no longer exists!^7 Visit https://documentation.esx-framework.org/tutorials/tutorials-esx/sharedevent for how to fix!"):format(Invoke)) end) diff --git a/[core]/es_extended/client/functions.lua b/[core]/es_extended/client/functions.lua index 13ea8eae2..a4e628d19 100644 --- a/[core]/es_extended/client/functions.lua +++ b/[core]/es_extended/client/functions.lua @@ -352,7 +352,7 @@ function ESX.Game.SpawnVehicle(vehicleModel, coords, heading, cb, networked) local dist = #(playerCoords - vector) if dist > 424 then -- Onesync infinity Range (https://docs.fivem.net/docs/scripting-reference/onesync/) local executingResource = GetInvokingResource() or "Unknown" - return print(("[^1ERROR^7] Resource ^5%s^7 Tried to spawn vehicle on the client but the position is too far away (Out of onesync range)."):format(executingResource)) + return error(("Resource ^5%s^7 Tried to spawn vehicle on the client but the position is too far away (Out of onesync range)."):format(executingResource)) end CreateThread(function() @@ -507,7 +507,7 @@ function ESX.Game.GetClosestEntity(entities, isPlayerEntities, coords, modelFilt if modelFilter then filteredEntities = {} - + for currentEntityIndex = 1, #entities do if modelFilter[GetEntityModel(entities[currentEntityIndex])] then filteredEntities[#filteredEntities + 1] = entities[currentEntityIndex] diff --git a/[core]/es_extended/client/main.lua b/[core]/es_extended/client/main.lua index 09d51c967..bbb8993ca 100644 --- a/[core]/es_extended/client/main.lua +++ b/[core]/es_extended/client/main.lua @@ -37,7 +37,7 @@ function ESX.SpawnPlayer(skin, coords, cb) while not HasCollisionLoadedAroundEntity(playerPed) and (GetGameTimer() - timer) < 5000 do Wait(0) end - + NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, coords.heading, true, true, false) TriggerEvent('playerSpawned', coords) cb() @@ -337,17 +337,17 @@ if not Config.OxInventory then RegisterNetEvent("esx:addWeapon") AddEventHandler("esx:addWeapon", function() - print("[^1ERROR^7] event ^5'esx:addWeapon'^7 Has Been Removed. Please use ^5xPlayer.addWeapon^7 Instead!") + error("event ^5'esx:addWeapon'^7 Has Been Removed. Please use ^5xPlayer.addWeapon^7 Instead!") end) RegisterNetEvent("esx:addWeaponComponent") AddEventHandler("esx:addWeaponComponent", function() - print("[^1ERROR^7] event ^5'esx:addWeaponComponent'^7 Has Been Removed. Please use ^5xPlayer.addWeaponComponent^7 Instead!") + error("event ^5'esx:addWeaponComponent'^7 Has Been Removed. Please use ^5xPlayer.addWeaponComponent^7 Instead!") end) RegisterNetEvent("esx:setWeaponAmmo") AddEventHandler("esx:setWeaponAmmo", function() - print("[^1ERROR^7] event ^5'esx:setWeaponAmmo'^7 Has Been Removed. Please use ^5xPlayer.addWeaponAmmo^7 Instead!") + error("event ^5'esx:setWeaponAmmo'^7 Has Been Removed. Please use ^5xPlayer.addWeaponAmmo^7 Instead!") end) RegisterNetEvent("esx:setWeaponTint") @@ -357,7 +357,7 @@ if not Config.OxInventory then RegisterNetEvent("esx:removeWeapon") AddEventHandler("esx:removeWeapon", function() - print("[^1ERROR^7] event ^5'esx:removeWeapon'^7 Has Been Removed. Please use ^5xPlayer.removeWeapon^7 Instead!") + error("event ^5'esx:removeWeapon'^7 Has Been Removed. Please use ^5xPlayer.removeWeapon^7 Instead!") end) RegisterNetEvent("esx:removeWeaponComponent") @@ -721,4 +721,4 @@ end) RegisterNetEvent('esx:updatePlayerData', function(key, val) ESX.SetPlayerData(key, val) -end) \ No newline at end of file +end) diff --git a/[core]/es_extended/client/modules/callback.lua b/[core]/es_extended/client/modules/callback.lua index cf58c391c..337b26b76 100644 --- a/[core]/es_extended/client/modules/callback.lua +++ b/[core]/es_extended/client/modules/callback.lua @@ -16,7 +16,7 @@ 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 error(("Server Callback with requestId ^5%s^7 Was Called by ^5%s^7 but does not exist."):format(requestId, invoker)) end serverRequests[requestId](...) @@ -31,7 +31,7 @@ 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 error(("Client Callback not registered, name: ^5%s^7, invoker resource: ^5%s^7"):format(eventName, invoker)) end clientCallbacks[eventName](function(...) diff --git a/[core]/es_extended/locale.lua b/[core]/es_extended/locale.lua index f9a29e9bd..cb857f3d7 100644 --- a/[core]/es_extended/locale.lua +++ b/[core]/es_extended/locale.lua @@ -2,7 +2,7 @@ Locales = {} function Translate(str, ...) -- Translate string if not str then - print(("[^1ERROR^7] Resource ^5%s^7 You did not specify a parameter for the Translate function or the value is nil!"):format(GetInvokingResource() or GetCurrentResourceName())) + error(("Resource ^5%s^7 You did not specify a parameter for the Translate function or the value is nil!"):format(GetInvokingResource() or GetCurrentResourceName())) return "Given translate function parameter is nil!" end if Locales[Config.Locale] then diff --git a/[core]/es_extended/server/classes/player.lua b/[core]/es_extended/server/classes/player.lua index a83c566a2..709031fdf 100644 --- a/[core]/es_extended/server/classes/player.lua +++ b/[core]/es_extended/server/classes/player.lua @@ -273,7 +273,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, function self.setAccountMoney(accountName, money, reason) reason = reason or "unknown" if not tonumber(money) then - print(("[^1ERROR^7] Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7"):format(accountName, self.playerId, money)) + error(("Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7"):format(accountName, self.playerId, money)) return end if money >= 0 then @@ -286,10 +286,10 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, self.triggerEvent("esx:setAccountMoney", account) _TriggerEvent("esx:setAccountMoney", self.source, accountName, money, reason) else - print(("[^1ERROR^7] Tried To Set Invalid Account ^5%s^0 For Player ^5%s^0!"):format(accountName, self.playerId)) + error(("Tried To Set Invalid Account ^5%s^0 For Player ^5%s^0!"):format(accountName, self.playerId)) end else - print(("[^1ERROR^7] Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7"):format(accountName, self.playerId, money)) + error(("Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7"):format(accountName, self.playerId, money)) end end @@ -300,7 +300,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, function self.addAccountMoney(accountName, money, reason) reason = reason or "Unknown" if not tonumber(money) then - print(("[^1ERROR^7] Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7"):format(accountName, self.playerId, money)) + error(("Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7"):format(accountName, self.playerId, money)) return end if money > 0 then @@ -312,10 +312,10 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, self.triggerEvent("esx:setAccountMoney", account) _TriggerEvent("esx:addAccountMoney", self.source, accountName, money, reason) else - print(("[^1ERROR^7] Tried To Set Add To Invalid Account ^5%s^0 For Player ^5%s^0!"):format(accountName, self.playerId)) + error(("Tried To Set Add To Invalid Account ^5%s^0 For Player ^5%s^0!"):format(accountName, self.playerId)) end else - print(("[^1ERROR^7] Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7"):format(accountName, self.playerId, money)) + error(("Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7"):format(accountName, self.playerId, money)) end end @@ -326,7 +326,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, function self.removeAccountMoney(accountName, money, reason) reason = reason or "Unknown" if not tonumber(money) then - print(("[^1ERROR^7] Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7"):format(accountName, self.playerId, money)) + error(("Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7"):format(accountName, self.playerId, money)) return end if money > 0 then @@ -335,7 +335,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, if account then money = account.round and ESX.Math.Round(money) or money if self.accounts[account.index].money - money > self.accounts[account.index].money then - print(("[^1ERROR^7] Tried To Underflow Account ^5%s^0 For Player ^5%s^0!"):format(accountName, self.playerId)) + error(("Tried To Underflow Account ^5%s^0 For Player ^5%s^0!"):format(accountName, self.playerId)) return end self.accounts[account.index].money = self.accounts[account.index].money - money @@ -343,10 +343,10 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, self.triggerEvent("esx:setAccountMoney", account) _TriggerEvent("esx:removeAccountMoney", self.source, accountName, money, reason) else - print(("[^1ERROR^7] Tried To Set Add To Invalid Account ^5%s^0 For Player ^5%s^0!"):format(accountName, self.playerId)) + error(("Tried To Set Add To Invalid Account ^5%s^0 For Player ^5%s^0!"):format(accountName, self.playerId)) end else - print(("[^1ERROR^7] Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7"):format(accountName, self.playerId, money)) + error(("Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number -> ^5%s^7"):format(accountName, self.playerId, money)) end end @@ -396,7 +396,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, self.triggerEvent("esx:removeInventoryItem", item.name, item.count) end else - print(("[^1ERROR^7] Player ID:^5%s Tried remove a Invalid count -> %s of %s"):format(self.playerId, count, itemName)) + error(("Player ID:^5%s Tried remove a Invalid count -> %s of %s"):format(self.playerId, count, itemName)) end end end @@ -598,7 +598,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, local weaponLabel, playerPed = nil, _GetPlayerPed(self.source) if not playerPed then - return print("[^1ERROR^7] xPlayer.removeWeapon ^5invalid^7 player ped!") + return error("xPlayer.removeWeapon ^5invalid^7 player ped!") end for k, v in ipairs(self.loadout) do @@ -755,12 +755,12 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, end if type(index) ~= "string" then - return print("[^1ERROR^7] xPlayer.getMeta ^5index^7 should be ^5string^7!") + return error("xPlayer.getMeta ^5index^7 should be ^5string^7!") end local metaData = self.metadata[index] if metaData == nil then - return Config.EnableDebug and print(("[^1ERROR^7] xPlayer.getMeta ^5%s^7 not exist!"):format(index)) or nil + return Config.EnableDebug and error(("xPlayer.getMeta ^5%s^7 not exist!"):format(index)) or nil end if subIndex and type(metaData) == "table" then @@ -779,14 +779,14 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, if type(key) == "string" then returnValues[key] = self.getMeta(index, key) else - print(("[^1ERROR^7] xPlayer.getMeta subIndex should be ^5string^7 or ^5table^7! that contains ^5string^7, received ^5%s^7!, skipping..."):format(type(key))) + error(("xPlayer.getMeta subIndex should be ^5string^7 or ^5table^7! that contains ^5string^7, received ^5%s^7!, skipping..."):format(type(key))) end end return returnValues end - return print(("[^1ERROR^7] xPlayer.getMeta subIndex should be ^5string^7 or ^5table^7!, received ^5%s^7!"):format(_type)) + return error(("xPlayer.getMeta subIndex should be ^5string^7 or ^5table^7!, received ^5%s^7!"):format(_type)) end return metaData @@ -798,28 +798,28 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, ---@return void function self.setMeta(index, value, subValue) if not index then - return print("[^1ERROR^7] xPlayer.setMeta ^5index^7 is Missing!") + return error("xPlayer.setMeta ^5index^7 is Missing!") end if type(index) ~= "string" then - return print("[^1ERROR^7] xPlayer.setMeta ^5index^7 should be ^5string^7!") + return error("xPlayer.setMeta ^5index^7 should be ^5string^7!") end if value == nil then - return print("[^1ERROR^7] xPlayer.setMeta value is missing!") + return error("xPlayer.setMeta value is missing!") end local _type = type(value) if not subValue then if _type ~= "number" and _type ~= "string" and _type ~= "table" then - return print(("[^1ERROR^7] xPlayer.setMeta ^5%s^7 should be ^5number^7 or ^5string^7 or ^5table^7!"):format(value)) + return error(("xPlayer.setMeta ^5%s^7 should be ^5number^7 or ^5string^7 or ^5table^7!"):format(value)) end self.metadata[index] = value else if _type ~= "string" then - return print(("[^1ERROR^7] xPlayer.setMeta ^5value^7 should be ^5string^7 as a subIndex!"):format(value)) + return error(("xPlayer.setMeta ^5value^7 should be ^5string^7 as a subIndex!"):format(value)) end if not self.metadata[index] or type(self.metadata[index]) ~= "table" then @@ -834,16 +834,16 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, function self.clearMeta(index, subValues) if not index then - return print("[^1ERROR^7] xPlayer.clearMeta ^5index^7 is Missing!") + return error("xPlayer.clearMeta ^5index^7 is Missing!") end if type(index) ~= "string" then - return print("[^1ERROR^7] xPlayer.clearMeta ^5index^7 should be ^5string^7!") + return error("xPlayer.clearMeta ^5index^7 should be ^5string^7!") end local metaData = self.metadata[index] if metaData == nil then - return Config.EnableDebug and print(("[^1ERROR^7] xPlayer.clearMeta ^5%s^7 does not exist!"):format(index)) or nil + return Config.EnableDebug and error(("xPlayer.clearMeta ^5%s^7 does not exist!"):format(index)) or nil end if not subValues then @@ -854,7 +854,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, if type(metaData) == "table" then metaData[subValues] = nil else - return print(("[^1ERROR^7] xPlayer.clearMeta ^5%s^7 is not a table! Cannot clear subValue ^5%s^7."):format(index, subValues)) + return error(("xPlayer.clearMeta ^5%s^7 is not a table! Cannot clear subValue ^5%s^7."):format(index, subValues)) end elseif type(subValues) == "table" then -- If subValues is a table, we will clear multiple subValues within the table @@ -864,14 +864,14 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, if type(metaData) == "table" then metaData[subValue] = nil else - print(("[^1ERROR^7] xPlayer.clearMeta ^5%s^7 is not a table! Cannot clear subValue ^5%s^7."):format(index, subValue)) + error(("xPlayer.clearMeta ^5%s^7 is not a table! Cannot clear subValue ^5%s^7."):format(index, subValue)) end else - print(("[^1ERROR^7] xPlayer.clearMeta subValues should contain ^5string^7, received ^5%s^7, skipping..."):format(type(subValue))) + error(("xPlayer.clearMeta subValues should contain ^5string^7, received ^5%s^7, skipping..."):format(type(subValue))) end end else - return print(("[^1ERROR^7] xPlayer.clearMeta ^5subValues^7 should be ^5string^7 or ^5table^7, received ^5%s^7!"):format(type(subValues))) + return error(("xPlayer.clearMeta ^5subValues^7 should be ^5string^7 or ^5table^7, received ^5%s^7!"):format(type(subValues))) end self.triggerEvent('esx:updatePlayerData', 'metadata', self.metadata) end diff --git a/[core]/es_extended/server/common.lua b/[core]/es_extended/server/common.lua index 68bc94c94..58326b42a 100644 --- a/[core]/es_extended/server/common.lua +++ b/[core]/es_extended/server/common.lua @@ -20,7 +20,7 @@ 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://documentation.esx-framework.org/tutorials/tutorials-esx/sharedevent for how to fix!"):format(Invoke)) + error(("Resource ^5%s^7 Used the ^5getSharedObject^7 Event, this event ^1no longer exists!^7 Visit https://documentation.esx-framework.org/tutorials/tutorials-esx/sharedevent for how to fix!"):format(Invoke)) end) exports("getSharedObject", function() diff --git a/[core]/es_extended/server/main.lua b/[core]/es_extended/server/main.lua index 9a74f9e7d..26cab119f 100644 --- a/[core]/es_extended/server/main.lua +++ b/[core]/es_extended/server/main.lua @@ -260,7 +260,7 @@ function loadESXPlayer(identifier, playerId, isNew) local name = ("%s %s"):format(result.firstname, result.lastname) userData.name = name - + xPlayer.set("firstName", result.firstname) xPlayer.set("lastName", result.lastname) xPlayer.setName(name) @@ -689,13 +689,13 @@ AddEventHandler("onResourceStart", function(key) end StopResource(key) - print(("[^1ERROR^7] WE STOPPED A RESOURCE THAT WILL BREAK ^1ESX^7, PLEASE REMOVE ^5%s^7"):format(key)) + error(("WE STOPPED A RESOURCE THAT WILL BREAK ^1ESX^7, PLEASE REMOVE ^5%s^7"):format(key)) end end) for key in pairs(DoNotUse) do if GetResourceState(key) == "started" or GetResourceState(key) == "starting" then StopResource(key) - print(("[^1ERROR^7] WE STOPPED A RESOURCE THAT WILL BREAK ^1ESX^7, PLEASE REMOVE ^5%s^7"):format(key)) + error(("WE STOPPED A RESOURCE THAT WILL BREAK ^1ESX^7, PLEASE REMOVE ^5%s^7"):format(key)) end end diff --git a/[core]/es_extended/server/modules/callback.lua b/[core]/es_extended/server/modules/callback.lua index 6a1bc7ae9..9fad6bfca 100644 --- a/[core]/es_extended/server/modules/callback.lua +++ b/[core]/es_extended/server/modules/callback.lua @@ -11,7 +11,7 @@ end RegisterNetEvent("esx:triggerServerCallback", function(eventName, requestId, invoker, ...) if not serverCallbacks[eventName] then - return print(("[^1ERROR^7] Server Callback not registered, name: ^5%s^7, invoker resource: ^5%s^7"):format(eventName, invoker)) + return error(("Server Callback not registered, name: ^5%s^7, invoker resource: ^5%s^7"):format(eventName, invoker)) end local source = source @@ -35,7 +35,7 @@ end RegisterNetEvent("esx:clientCallback", function(requestId, invoker, ...) if not clientRequests[requestId] then - return print(("[^1ERROR^7] Client Callback with requestId ^5%s^7 Was Called by ^5%s^7 but does not exist."):format(requestId, invoker)) + return error(("Client Callback with requestId ^5%s^7 Was Called by ^5%s^7 but does not exist."):format(requestId, invoker)) end clientRequests[requestId](...) diff --git a/[core]/es_extended/server/onesync.lua b/[core]/es_extended/server/onesync.lua index ed2324bea..cb4ad40a1 100644 --- a/[core]/es_extended/server/onesync.lua +++ b/[core]/es_extended/server/onesync.lua @@ -93,14 +93,14 @@ function ESX.OneSync.SpawnVehicle(model, coords, heading, properties, cb) if vehicleType then local createdVehicle = CreateVehicleServerSetter(vehicleModel, vehicleType, coords, heading) if not DoesEntityExist(createdVehicle) then - return print("[^1ERROR^7] Unfortunately, this vehicle has not spawned") + return error("Unfortunately, this vehicle has not spawned") end local networkId = NetworkGetNetworkIdFromEntity(createdVehicle) Entity(createdVehicle).state:set("VehicleProperties", vehicleProperties, true) cb(networkId) else - print(("[^1ERROR^7] Tried to spawn invalid vehicle - ^5%s^7!"):format(model)) + error(("Tried to spawn invalid vehicle - ^5%s^7!"):format(model)) end end) end) From 27a92d165f522a265936df2c840481fd0c76b3cb Mon Sep 17 00:00:00 2001 From: Arctos2win <116841243+Arctos2win@users.noreply.github.com> Date: Sat, 19 Oct 2024 23:54:40 +0200 Subject: [PATCH 8/8] chore(readme.md): remove oxygenserv from readme --- readme.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/readme.md b/readme.md index fa53f825e..ef2abad0b 100644 --- a/readme.md +++ b/readme.md @@ -17,6 +17,3 @@ Interested in helping us? [Take a look at our patreon](https://www.patreon.com/e | Kyle McShea - Artin - Mathias Christoffersen - Jaylan Yilmaz - Callum | | CONGRESS KW - Michael Hein - Smery sitbon - daZepelin - CMF Community | ------ - -
-Powered by [Oxygenserv](https://www.oxygenserv.com/en/)