mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:01:22 +00:00
fix(es_extended): fix warnings caused by proper type annotations
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user