fix(es_extended): fix warnings caused by proper type annotations

This commit is contained in:
Kenshin13
2025-08-16 14:21:36 +02:00
parent 260d9b30ee
commit ceb2927fcd
7 changed files with 33 additions and 8 deletions
+3 -1
View File
@@ -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
+2 -2
View File
@@ -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
@@ -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"
+2 -1
View File
@@ -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 = {
+3 -2
View File
@@ -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)
+21
View File
@@ -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 = ""
@@ -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"