Enforcing consistent annotations and fixing spelling mistakes

This commit is contained in:
solaire-fivem committed 2025-10-04 19:39:26 +01:00
1 parent a15a79603b
commit 3ce3b7fe57
4 files changed
+137 -156

No files matched your search

+49 -68
View File
@@ -8,19 +8,19 @@ QBCore = exports['qb-core']:GetCoreObject()
Framework.Shared = QBCore.Shared
---This will return the name of the framework in use.
---@description This will return the name of the framework in use.
---@return string
Framework.GetFrameworkName = function()
return 'qb-core'
end
---This will get the name of the in use resource.
---@description This will get the name of the in use resource.
---@return string
Framework.GetResourceName = function()
return 'qb-core'
end
---This will return if the player is an admin in the framework.
---@description This will return if the player is an admin in the framework.
---@param src any
---@return boolean
Framework.GetIsFrameworkAdmin = function(src)
@@ -28,8 +28,7 @@ Framework.GetIsFrameworkAdmin = function(src)
return QBCore.Functions.HasPermission(src, 'admin')
end
-- Framework.GetPlayerIdentifier(src)
-- Returns the citizen ID of the player.
---@description This will return the citizen ID of the player.
---@param src number
---@return string | nil
Framework.GetPlayerIdentifier = function(src)
@@ -39,7 +38,7 @@ Framework.GetPlayerIdentifier = function(src)
return playerData.citizenid
end
--- Returns the player data of the specified source in the framework defualt format.
---@description Returns the player data of the specified source in the framework defualt format.
---@param src any
---@return table | nil
Framework.GetPlayer = function(src)
@@ -48,10 +47,8 @@ Framework.GetPlayer = function(src)
return player
end
---This will return the jobs registered in the framework in a table.
---Format of the table is:
---{name = jobName, label = jobLabel, grade = {name = gradeName, level = gradeLevel}}
---@return table
---@description This will return the jobs registered in the framework in a table.
---@return table {name = jobName, label = jobLabel, grade = {name = gradeName, level = gradeLevel}}
Framework.GetFrameworkJobs = function()
local jobs = {}
for k, v in pairs(QBCore.Shared.Jobs) do
@@ -64,8 +61,7 @@ Framework.GetFrameworkJobs = function()
return jobs
end
-- Framework.GetPlayerName(src)
-- Returns the first and last name of the player.
---@description Returns the first and last name of the player.
---@return string|nil, string|nil
Framework.GetPlayerName = function(src)
local player = Framework.GetPlayer(src)
@@ -74,7 +70,7 @@ Framework.GetPlayerName = function(src)
return playerData.charinfo.firstname, playerData.charinfo.lastname
end
---Returns the player date of birth.
---@description Returns the player date of birth.
---@param src number
---@return string|nil
Framework.GetPlayerDob = function(src)
@@ -84,12 +80,11 @@ Framework.GetPlayerDob = function(src)
return playerData.charinfo.birthdate
end
---Returns a table of items matching the specified name and if passed metadata from the player's inventory.
---returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
---@description Returns a table of items matching the specified name and if passed metadata from the player's inventory.
---@param src number
---@param item string
---@param metadata table
---@return table|nil
---@return table|nil {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
Framework.GetItem = function(src, item, metadata)
local player = Framework.GetPlayer(src)
if not player then return end
@@ -109,9 +104,9 @@ Framework.GetItem = function(src, item, metadata)
return repackedTable
end
---This will return a table with the item info, {name, label, stack, weight, description, image}
---@description This will return a table with the item info
---@param item string
---@return table
---@return table {name, label, stack, weight, description, image}
Framework.GetItemInfo = function(item)
local itemData = QBCore.Shared.Items[item]
if not itemData then return {} end
@@ -126,8 +121,7 @@ Framework.GetItemInfo = function(item)
return repackedTable
end
---This will return the count of the item in the players inventory, if not found will return 0.
---
---@description This will return the count of the item in the players inventory, if not found will return 0
---if metadata is passed it will find the matching items count.
---@param src number
---@param item string
@@ -147,7 +141,7 @@ Framework.GetItemCount = function(src, item, metadata)
return count
end
---This will return a boolean if the player has the item.
---@description This will return a boolean if the player has the item.
---@param src number
---@param item string
---@return boolean
@@ -156,11 +150,9 @@ Framework.HasItem = function(src, item)
return getCount > 0
end
-- Framework.GetPlayerInventory(src)
-- Returns the entire inventory of the player as a table.
-- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
---@description Returns the entire inventory of the player as a table.
---@param src number
---@return table | nil
---@return table | nil {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
Framework.GetPlayerInventory = function(src)
local player = Framework.GetPlayer(src)
if not player then return end
@@ -178,7 +170,7 @@ Framework.GetPlayerInventory = function(src)
return repackedTable
end
---This will return a table of all logged in players
---@description This will return a table of all logged in players
---@return table
Framework.GetPlayers = function()
local players = QBCore.Functions.GetPlayers()
@@ -189,11 +181,10 @@ Framework.GetPlayers = function()
return playerList
end
---This will return the item data for the specified slot.
---Format {name, label, weight, count, metadata, slot, stack, description}
---@description This will return the item data for the specified slot.
---@param src number
---@param slot number
---@return table|nil
---@return table|nil {name, label, weight, count, metadata, slot, stack, description}
Framework.GetItemBySlot = function(src, slot)
local player = Framework.GetPlayer(src)
if not player then return end
@@ -217,8 +208,7 @@ Framework.GetItemBySlot = function(src, slot)
return repack
end
-- Framework.SetMetadata(src, metadata, value)
-- Adds the specified metadata key and number value to the player's data.
---@description Adds the specified metadata key and number value to the player's data.
---@return boolean|nil
Framework.SetPlayerMetadata = function(src, metadata, value)
local player = Framework.GetPlayer(src)
@@ -227,8 +217,7 @@ Framework.SetPlayerMetadata = function(src, metadata, value)
return true
end
-- Framework.GetMetadata(src, metadata)
-- Gets the specified metadata key to the player's data.
---@description Gets the specified metadata key to the player's data.
---@param src number
---@param metadata string
---@return any|nil
@@ -239,8 +228,8 @@ Framework.GetPlayerMetadata = function(src, metadata)
return playerData.metadata[metadata] or false
end
-- Framework.AddStress(src, value)
-- Adds the specified value to the player's stress level and updates the client HUD.
---@description Adds the specified value to the player's stress level and updates the client HUD.
---@param src number
---@param value number
---@return number | nil
@@ -254,8 +243,7 @@ Framework.AddStress = function(src, value)
return newStress
end
-- Framework.RemoveStress(src, value)
-- Removes the specified value from the player's stress level and updates the client HUD.
---@description Removes the specified value from the player's stress level and updates the client HUD.
---@param src number
---@param value number
---@return number | nil
@@ -269,8 +257,7 @@ Framework.RemoveStress = function(src, value)
return newStress
end
-- Framework.AddHunger(src, value)
-- Adds the specified value from the player's hunger level.
---@description Adds the specified value from the player's hunger level.
---@param src number
---@param value number
---@return number | nil
@@ -285,8 +272,7 @@ Framework.AddHunger = function(src, value)
return newHunger
end
-- Framework.AddThirst(src, value)
-- Adds the specified value from the player's thirst level.
---@description Adds the specified value from the player's thirst level.
---@param src number
---@param value number
---@return number | nil
@@ -301,7 +287,7 @@ Framework.AddThirst = function(src, value)
return newThirst
end
---This will get the hunger of a player
---@description This will get the hunger of a player
---@param src number
---@return number | nil
Framework.GetHunger = function(src)
@@ -312,7 +298,7 @@ Framework.GetHunger = function(src)
return math.floor((newHunger) + 0.5) or 0
end
---This will return a boolean if the player is dead or in last stand.
---@description This will return a boolean if the player is dead or in last stand.
---@param src number
---@return boolean|nil
Framework.GetIsPlayerDead = function(src)
@@ -322,7 +308,7 @@ Framework.GetIsPlayerDead = function(src)
return playerData.metadata.isdead or playerData.metadata.inlaststand or false
end
---This will revive a player, if the player is dead or in last stand.
---@description This will revive a player, if the player is dead or in last stand.
---@param src number
---@return boolean
Framework.RevivePlayer = function(src)
@@ -333,7 +319,7 @@ Framework.RevivePlayer = function(src)
end
---This will get the thirst of a player
---@description This will get the thirst of a player
---@param src any
---@return number | nil
Framework.GetThirst = function(src)
@@ -344,8 +330,7 @@ Framework.GetThirst = function(src)
return math.floor((newThirst) + 0.5) or 0
end
-- Framework.GetPlayerPhone(src)
-- Returns the phone number of the player.
---@description Returns the phone number of the player.
---@param src number
---@return string | nil
Framework.GetPlayerPhone = function(src)
@@ -355,8 +340,7 @@ Framework.GetPlayerPhone = function(src)
return playerData.charinfo.phone
end
-- Framework.GetPlayerGang(src)
-- Returns the gang name of the player.
---@description Returns the gang name of the player.
---@param src number
---@return string | nil
Framework.GetPlayerGang = function(src)
@@ -366,14 +350,14 @@ Framework.GetPlayerGang = function(src)
return playerData.gang.name
end
---This will get a table of player sources that have the specified job name.
---@description This will get a table of player sources that have the specified job name.
---@param job string
---@return table
Framework.GetPlayersByJob = function(job)
return Framework.GetPlayerSourcesByJob(job) or {}
end
---Depricated: Returns the job name, label, grade name, and grade level of the player.
---@deprecated Deprecated: Returns the job name, label, grade name, and grade level of the player.
---@param src number
---@return string | string | string | number | nil
---@return string | string | string | number | nil
@@ -386,7 +370,8 @@ Framework.GetPlayerJob = function(src)
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
end
---This will return the players job name, job label, job grade label job grade level, boss status, and duty status in a table
---@description This will return the players job name, job label, job grade label job grade level, boss status,
---and duty status in a table
---@param src number
---@return table | nil
Framework.GetPlayerJobData = function(src)
@@ -405,7 +390,7 @@ Framework.GetPlayerJobData = function(src)
}
end
---Returns the players duty status.
---@description Returns the players duty status.
---@param src number
---@return boolean | nil
Framework.GetPlayerDuty = function(src)
@@ -416,7 +401,7 @@ Framework.GetPlayerDuty = function(src)
return true
end
---This will toggle a players duty status
---@description This will toggle a players duty status
---@param src number
---@param status boolean
---@return boolean
@@ -428,7 +413,7 @@ Framework.SetPlayerDuty = function(src, status)
return true
end
-- Sets the player's job to the specified name and grade.
---@description Sets the player's job to the specified name and grade.
---@param src number
---@param name string
---@param grade string
@@ -439,7 +424,7 @@ Framework.SetPlayerJob = function(src, name, grade)
return player.Functions.SetJob(name, grade)
end
---This will add money based on the type of account (money/bank)
---@description This will add money based on the type of account (money/bank)
---@param src number
---@param _type string
---@param amount number
@@ -451,7 +436,7 @@ Framework.AddAccountBalance = function(src, _type, amount)
return player.Functions.AddMoney(_type, amount)
end
---This will remove money based on the type of account (money/bank)
---@description This will remove money based on the type of account (money/bank)
---@param src number
---@param _type string
---@param amount number
@@ -463,7 +448,7 @@ Framework.RemoveAccountBalance = function(src, _type, amount)
return player.Functions.RemoveMoney(_type, amount)
end
---This will remove money based on the type of account (money/bank)
---@description This will remove money based on the type of account (money/bank)
---@param src number
---@param _type string
---@return string | nil
@@ -475,8 +460,7 @@ Framework.GetAccountBalance = function(src, _type)
return playerData.money[_type]
end
-- Framework.AddItem(src, item, amount, slot, metadata)
-- Adds the specified item to the player's inventory.
---@description Adds the specified item to the player's inventory.
---@param src number
---@param item string
---@param amount number
@@ -490,8 +474,7 @@ Framework.AddItem = function(src, item, amount, slot, metadata)
return player.Functions.AddItem(item, amount, slot, metadata)
end
-- Framework.RemoveItem(src, item, amount, slot, metadata)
-- Removes the specified item from the player's inventory.
---@description Removes the specified item from the player's inventory.
---@param src number
---@param item string
---@param amount number
@@ -505,9 +488,8 @@ Framework.RemoveItem = function(src, item, amount, slot, metadata)
return player.Functions.RemoveItem(item, amount, slot or nil)
end
-- Framework.SetMetadata(src, item, slot, metadata)
-- Sets the metadata for the specified item in the player's inventory.
-- Notes, this is kinda a jank workaround. with the framework aside from updating the entire table theres not really a better way
---@description Sets the metadata for the specified item in the player's inventory.
---Notes, this is kinda a jank workaround. with the framework aside from updating the entire table theres not really a better way
---@param src number
---@param item string
---@param slot number
@@ -531,7 +513,7 @@ Framework.SetMetadata = function(src, item, slot, metadata)
return player.Functions.AddItem(item, 1, slot, metadata)
end
---This will get all owned vehicles for the player
---@description This will get all owned vehicles for the player
---@param src number
---@return table
Framework.GetOwnedVehicles = function(src)
@@ -546,8 +528,7 @@ Framework.GetOwnedVehicles = function(src)
return vehicles
end
-- Framework.RegisterUsableItem(item, cb)
-- Registers a usable item with a callback function.
---@description Registers a usable item with a callback function.
---@param itemName string
---@param cb function
Framework.RegisterUsableItem = function(itemName, cb)