mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 17:58:54 +00:00
refactor(server/common): format code
This commit is contained in:
@@ -19,68 +19,68 @@ AddEventHandler("esx:getSharedObject", function()
|
||||
end)
|
||||
|
||||
exports('getSharedObject', function()
|
||||
return ESX
|
||||
return ESX
|
||||
end)
|
||||
|
||||
if GetResourceState('ox_inventory') ~= 'missing' then
|
||||
Config.OxInventory = true
|
||||
Config.PlayerFunctionOverride = 'OxInventory'
|
||||
SetConvarReplicated('inventory:framework', 'esx')
|
||||
SetConvarReplicated('inventory:weight', Config.MaxWeight * 1000)
|
||||
Config.OxInventory = true
|
||||
Config.PlayerFunctionOverride = 'OxInventory'
|
||||
SetConvarReplicated('inventory:framework', 'esx')
|
||||
SetConvarReplicated('inventory:weight', Config.MaxWeight * 1000)
|
||||
end
|
||||
|
||||
local function StartDBSync()
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(10 * 60 * 1000)
|
||||
Core.SavePlayers()
|
||||
end
|
||||
end)
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(10 * 60 * 1000)
|
||||
Core.SavePlayers()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
MySQL.ready(function()
|
||||
Core.DatabaseConnected = true
|
||||
if not Config.OxInventory then
|
||||
local items = MySQL.query.await('SELECT * FROM items')
|
||||
for k, v in ipairs(items) do
|
||||
ESX.Items[v.name] = {label = v.label, weight = v.weight, rare = v.rare, canRemove = v.can_remove}
|
||||
end
|
||||
else
|
||||
TriggerEvent('__cfx_export_ox_inventory_Items', function(ref)
|
||||
if ref then
|
||||
ESX.Items = ref()
|
||||
end
|
||||
end)
|
||||
Core.DatabaseConnected = true
|
||||
if not Config.OxInventory then
|
||||
local items = MySQL.query.await('SELECT * FROM items')
|
||||
for k, v in ipairs(items) do
|
||||
ESX.Items[v.name] = {label = v.label, weight = v.weight, rare = v.rare, canRemove = v.can_remove}
|
||||
end
|
||||
else
|
||||
TriggerEvent('__cfx_export_ox_inventory_Items', function(ref)
|
||||
if ref then
|
||||
ESX.Items = ref()
|
||||
end
|
||||
end)
|
||||
|
||||
AddEventHandler('ox_inventory:itemList', function(items)
|
||||
ESX.Items = items
|
||||
end)
|
||||
AddEventHandler('ox_inventory:itemList', function(items)
|
||||
ESX.Items = items
|
||||
end)
|
||||
|
||||
while not next(ESX.Items) do
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
while not next(ESX.Items) do
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
ESX.RefreshJobs()
|
||||
ESX.RefreshJobs()
|
||||
|
||||
print(('[^2INFO^7] ESX ^5Legacy %s^0 initialized!'):format(GetResourceMetadata(GetCurrentResourceName(), "version", 0)))
|
||||
|
||||
StartDBSync()
|
||||
if Config.EnablePaycheck then
|
||||
print(('[^2INFO^7] ESX ^5Legacy %s^0 initialized!'):format(GetResourceMetadata(GetCurrentResourceName(), "version", 0)))
|
||||
|
||||
StartDBSync()
|
||||
if Config.EnablePaycheck then
|
||||
StartPayCheck()
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx:clientLog')
|
||||
AddEventHandler('esx:clientLog', function(msg)
|
||||
if Config.EnableDebug then
|
||||
print(('[^2TRACE^7] %s^7'):format(msg))
|
||||
end
|
||||
if Config.EnableDebug then
|
||||
print(('[^2TRACE^7] %s^7'):format(msg))
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent("esx:ReturnVehicleType", function(Type, Request)
|
||||
if Core.ClientCallbacks[Request] then
|
||||
Core.ClientCallbacks[Request](Type)
|
||||
Core.ClientCallbacks[Request] = nil
|
||||
end
|
||||
if Core.ClientCallbacks[Request] then
|
||||
Core.ClientCallbacks[Request](Type)
|
||||
Core.ClientCallbacks[Request] = nil
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user