Merge pull request #1016 from xSwellington/patch-1

Update functions.lua
This commit is contained in:
Kakarot
2023-09-21 22:18:06 -05:00
committed by GitHub
+27
View File
@@ -88,6 +88,33 @@ function QBCore.Functions.GetPlayerByPhone(number)
return nil
end
---Get player by account id
---@param account string
---@return table?
function QBCore.Functions.GetPlayerByAccount(account)
for src in pairs(QBCore.Players) do
if QBCore.Players[src].PlayerData.charinfo.account == account then
return QBCore.Players[src]
end
end
return nil
end
---Get player passing property and value to check exists
---@param property string
---@param value string
---@return table?
function QBCore.Functions.GetPlayerByCharInfo(property, value)
for src in pairs(QBCore.Players) do
local charinfo = QBCore.Players[src].PlayerData.charinfo
if charinfo[property] ~= nil and charinfo[property] == value then
return QBCore.Players[src]
end
end
return nil
end
---Get all players. Returns the server ids of all players.
---@return table
function QBCore.Functions.GetPlayers()