Server/no_escrow.lua
-- Framework ------------------------------------------------------------------------------------
local Framework = {}
if Config.Settings['Framework'] == 'esx' or Config.Settings['Framework'] == 'old-esx' then
Framework = {
Get_Player = function(src)
if Config.Settings['Framework'] == 'esx' then
return exports['es_extended']:getSharedObject().GetPlayerFromId(src)
elseif Config.Settings['Framework'] == 'old-esx' then
local Player = nil
TriggerEvent('esx:getSharedObject', function(obj) Player = obj.GetPlayerFromId(src) end)
return Player
end
end,
Get_Last_Location = function(player)
local result = Execute_Sql('SELECT position FROM users WHERE identifier = @identifier', {['@identifier'] = player.identifier})
if result[1] then
return json.decode(result[1].position)
end
return nil
end,
Is_Player_Dead = function(player)
local result = Execute_Sql('SELECT is_dead FROM users WHERE identifier = @identifier', {['@identifier'] = player.identifier})
if result[1] then
return result[1].is_dead
end
return false
end,
Get_Player_Name = function(player)
local result = Execute_Sql('SELECT firstname, lastname FROM users WHERE identifier = @identifier', {['@identifier'] = player.identifier})
if result[1] then
return result[1].firstname .. ' ' .. result[1].lastname
end
return 'Unknown'
end,
Get_Housing_Info = function(player)
return
end,
Is_Player_In_Jail = function(player)
local result = Execute_Sql('SELECT in_jail FROM users WHERE identifier = @identifier', {['@identifier'] = player.identifier})
if result[1] then
return result[1].in_jail
end
return false
end
}
elseif Config.Settings['Framework'] == 'qb' or Config.Settings['Framework'] == 'old-qb' or Config.Settings['Framework'] == 'qbox' then
Framework = {
Get_Player = function(src)
if Config.Settings['Framework'] == 'qb' then
return exports['qb-core']:GetCoreObject().Functions.GetPlayer(src)
elseif Config.Settings['Framework'] == 'old-qb' then
local Player = nil
Citizen.CreateThread(function()
while Player == nil do
TriggerEvent('QBCore:GetObject', function(obj) Player = obj.Functions.GetPlayer(src) end)
Citizen.Wait(200)
end
end)
return Player
elseif Config.Settings['Framework'] == 'qbx' then
if GetResourceState('qbx_core') == 'started' then
return exports['qbx-core']:GetCoreObject().Functions.GetPlayer(src)
elseif GetResourceState('qbx-core') == 'started' then
return exports['qbx_core']:GetCoreObject().Functions.GetPlayer(src)
end
end
end,
Get_Last_Location = function(player)
return player.PlayerData.position
end,
Is_Player_Dead = function(player)
return player.PlayerData.metadata['isdead']
end,
Get_Player_Name = function(player)
return player.PlayerData.charinfo.firstname .. ' ' .. player.PlayerData.charinfo.lastname
end,
Get_Housing_Info = function(player)
local metadata = player.PlayerData.metadata.inside
if metadata then
return {
house = metadata.house,
apartment = metadata.apartment
}
end
return { house = nil, apartment = nil }
end,
Is_Player_In_Jail = function(player)
return player.PlayerData.metadata['injail']
end
}
elseif Config.Settings['Framework'] == 'custom' then
Framework = {
Get_Player = function(src)
return -- | # If you are using a custom framework, fill in this section accordingly.
end,
Get_Last_Location = function(player)
return -- | # If you are using a custom framework, fill in this section accordingly.
end,
Is_Player_Dead = function(player)
return -- | # If you are using a custom framework, fill in this section accordingly.
end,
Get_Player_Name = function(player)
return -- | # If you are using a custom framework, fill in this section accordingly.
end,
Get_Housing_Info = function(player)
return -- | # If you are using a custom framework, fill in this section accordingly.
end,
Is_Player_In_Jail = function(player)
return -- | # If you are using a custom framework, fill in this section accordingly.
end
}
end
-- Get Player Information -------------------------------------------------------------------------
Get_Player_Info = function(source)
local src = tonumber(source)
local Player = Framework.Get_Player(src)
if not Player then return nil end
local Last_Location = Framework.Get_Last_Location(Player)
local Is_Dead = Framework.Is_Player_Dead(Player)
local In_Jail = Framework.Is_Player_In_Jail(Player)
local Name = Framework.Get_Player_Name(Player)
local Housing_Info = Framework.Get_Housing_Info(Player)
return {
Name = Name,
Last_Location = Last_Location,
Is_Dead = Is_Dead,
Housing_Info = Housing_Info
}
end
Last updated