mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 01:01:24 +00:00
Merge pull request #1161 from Cocodrulo/feature/getname
Feat: Added Player.Functions.GetName() function and QBCore.Functions.GetName()
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user