diff --git a/[core]/es_extended/client/functions.lua b/[core]/es_extended/client/functions.lua index 6d507e63..953296d2 100644 --- a/[core]/es_extended/client/functions.lua +++ b/[core]/es_extended/client/functions.lua @@ -1,4 +1,5 @@ ---@return boolean +---@diagnostic disable-next-line: duplicate-set-field function ESX.IsPlayerLoaded() return ESX.PlayerLoaded end @@ -559,7 +560,8 @@ function ESX.Game.SpawnVehicle(vehicleModel, coords, heading, cb, networked) local modelHash = ESX.Streaming.RequestModel(model) if not modelHash then if promise then - return promise:reject(("Tried to spawn invalid vehicle - ^5%s^7!"):format(model)) + promise:reject(("Tried to spawn invalid vehicle - ^5%s^7!"):format(model)) + return end error(("Tried to spawn invalid vehicle - ^5%s^7!"):format(model)) end diff --git a/[core]/es_extended/client/imports/point.lua b/[core]/es_extended/client/imports/point.lua index 5c505cc8..8660569c 100644 --- a/[core]/es_extended/client/imports/point.lua +++ b/[core]/es_extended/client/imports/point.lua @@ -1,6 +1,6 @@ local Point = ESX.Class() -local nearby, loop = {} +local nearby, loop = {}, nil function Point:constructor(properties) self.coords = properties.coords @@ -23,7 +23,7 @@ function Point:constructor(properties) point:inside(#(coords - point.coords)) end end - Wait() + Wait(0) end end) end diff --git a/[core]/es_extended/client/modules/callback.lua b/[core]/es_extended/client/modules/callback.lua index 85facbb7..30211b9a 100644 --- a/[core]/es_extended/client/modules/callback.lua +++ b/[core]/es_extended/client/modules/callback.lua @@ -92,7 +92,7 @@ end ---@param eventName string ---@param ... any ----@return any +---@return ... function ESX.AwaitServerCallback(eventName, ...) local invokingResource = GetInvokingResource() local invoker = (invokingResource and invokingResource ~= "unknown") and invokingResource or "es_extended" diff --git a/[core]/es_extended/imports.lua b/[core]/es_extended/imports.lua index 0fd7f748..063df85c 100644 --- a/[core]/es_extended/imports.lua +++ b/[core]/es_extended/imports.lua @@ -218,9 +218,10 @@ if GetResourceState("ox_lib") == "missing" then return nil, err or 'unknown error' end + ---@diagnostic disable-next-line: duplicate-doc-alias ---@alias PackageSearcher ---| fun(modName: string): function loader - ---| fun(modName: string): nil, string errmsg + ---| fun(modName: string): nil|false, string errmsg ---@type PackageSearcher[] package.searchers = { diff --git a/[core]/es_extended/server/functions.lua b/[core]/es_extended/server/functions.lua index 403aab50..e54e90e7 100644 --- a/[core]/es_extended/server/functions.lua +++ b/[core]/es_extended/server/functions.lua @@ -367,16 +367,17 @@ end ---@param source number ---@return boolean +---@diagnostic disable-next-line: duplicate-set-field function ESX.IsPlayerLoaded(source) return ESX.Players[source] ~= nil end ---@param playerId number | string ----@return string +---@return string, number function ESX.GetIdentifier(playerId) local fxDk = GetConvarInt("sv_fxdkMode", 0) if fxDk == 1 then - return "ESX-DEBUG-LICENCE" + return "ESX-DEBUG-LICENCE", 0 end playerId = tostring(playerId) diff --git a/[core]/es_extended/server/main.lua b/[core]/es_extended/server/main.lua index 50fc369b..00efbfac 100644 --- a/[core]/es_extended/server/main.lua +++ b/[core]/es_extended/server/main.lua @@ -417,6 +417,10 @@ if not Config.CustomInventory then if itemType == "item_standard" then local sourceItem = sourceXPlayer.getInventoryItem(itemName) + if not sourceItem then + return + end + if itemCount < 1 or sourceItem.count < itemCount then return sourceXPlayer.showNotification(TranslateCap("imp_invalid_quantity")) end @@ -453,6 +457,10 @@ if not Config.CustomInventory then end local _, weapon = sourceXPlayer.getWeapon(itemName) + if not weapon then + return + end + local _, weaponObject = ESX.GetWeapon(itemName) itemCount = weapon.ammo local weaponComponents = ESX.Table.Clone(weapon.components) @@ -485,6 +493,9 @@ if not Config.CustomInventory then end local _, weapon = sourceXPlayer.getWeapon(itemName) + if not weapon then + return + end if not targetXPlayer.hasWeapon(itemName) then sourceXPlayer.showNotification(TranslateCap("gave_weapon_noweapon", targetXPlayer.name)) @@ -517,6 +528,9 @@ if not Config.CustomInventory then end local xItem = xPlayer.getInventoryItem(itemName) + if not xItem then + return + end if itemCount > xItem.count or xItem.count < 1 then return xPlayer.showNotification(TranslateCap("imp_invalid_quantity")) @@ -532,6 +546,9 @@ if not Config.CustomInventory then end local account = xPlayer.getAccount(itemName) + if not account then + return + end if itemCount > account.money or account.money < 1 then return xPlayer.showNotification(TranslateCap("imp_invalid_amount")) @@ -547,6 +564,10 @@ if not Config.CustomInventory then if not xPlayer.hasWeapon(itemName) then return end local _, weapon = xPlayer.getWeapon(itemName) + if not weapon then + return + end + local _, weaponObject = ESX.GetWeapon(itemName) -- luacheck: ignore weaponPickupLabel local weaponPickupLabel = "" diff --git a/[core]/es_extended/server/modules/callback.lua b/[core]/es_extended/server/modules/callback.lua index 1787c420..c0fa8f73 100644 --- a/[core]/es_extended/server/modules/callback.lua +++ b/[core]/es_extended/server/modules/callback.lua @@ -98,7 +98,7 @@ end ---@param player number playerId ---@param eventName string ---@param ... any ----@return any +---@return ... function ESX.AwaitClientCallback(player, eventName, ...) local invokingResource = GetInvokingResource() local invoker = (invokingResource and invokingResource ~= "Unknown") and invokingResource or "es_extended"