Merge pull request #1161 from Cocodrulo/feature/getname

Feat: Added Player.Functions.GetName() function and QBCore.Functions.GetName()
This commit is contained in:
Kakarot
2025-01-10 15:36:54 -05:00
committed by GitHub
2 changed files with 12 additions and 0 deletions
+7
View File
@@ -48,6 +48,13 @@ function QBCore.Functions.HasItem(items, amount)
return exports['qb-inventory']:HasItem(items, amount)
end
---Returns the full character name
---@return string
function QBCore.Functions.GetName()
local charinfo = QBCore.PlayerData.charinfo
return charinfo.firstname .. ' ' .. charinfo.lastname
end
---@param entity number - The entity to look at
---@param timeout number - The time in milliseconds before the function times out
---@param speed number - The speed at which the entity should turn
+5
View File
@@ -253,6 +253,11 @@ function QBCore.Player.CreatePlayer(PlayerData, Offline)
return QBCore.Functions.HasItem(self.PlayerData.source, items, amount)
end
function self.Functions.GetName()
local charinfo = self.PlayerData.charinfo
return charinfo.firstname .. ' ' .. charinfo.lastname
end
function self.Functions.SetJobDuty(onDuty)
self.PlayerData.job.onduty = not not onDuty
TriggerEvent('QBCore:Server:OnJobUpdate', self.PlayerData.source, self.PlayerData.job)