Add GetPlayerByLicense function

This commit is contained in:
Daniel GP
2023-05-15 22:26:06 +02:00
parent ae42ed2ac7
commit b156f5c658
2 changed files with 28 additions and 0 deletions
+21
View File
@@ -57,6 +57,27 @@ function QBCore.Player.GetOfflinePlayer(citizenid)
return nil
end
function QBCore.Player.GetPlayerByLicense(license)
if license then
local PlayerData = MySQL.Sync.prepare('SELECT * FROM players where license = ?', {license})
if PlayerData then
PlayerData.money = json.decode(PlayerData.money)
PlayerData.job = json.decode(PlayerData.job)
PlayerData.position = json.decode(PlayerData.position)
PlayerData.metadata = json.decode(PlayerData.metadata)
PlayerData.charinfo = json.decode(PlayerData.charinfo)
if PlayerData.gang then
PlayerData.gang = json.decode(PlayerData.gang)
else
PlayerData.gang = {}
end
return QBCore.Player.CheckPlayerData(nil, PlayerData)
end
end
return nil
end
function QBCore.Player.CheckPlayerData(source, PlayerData)
PlayerData = PlayerData or {}
local Offline = true