mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-01 10:48:52 +00:00
mysql-async v3.0.1 support
This commit is contained in:
+3
-4
@@ -147,7 +147,7 @@ function EnterProperty(name, owner)
|
||||
end
|
||||
end
|
||||
|
||||
SetEntityCoords(playerPed, property.inside.x, property.inside.y, property.inside.z)
|
||||
SetEntityCoords(playerPed, property.inside.x, property.inside.y, property.inside.z)
|
||||
DoScreenFadeIn(800)
|
||||
DrawSub(property.label, 5000)
|
||||
end)
|
||||
@@ -265,7 +265,7 @@ function OpenPropertyMenu(property)
|
||||
else
|
||||
if not Config.EnablePlayerManagement then
|
||||
table.insert(elements, {label = _U('buy'), value = 'buy'})
|
||||
table.insert(elements, {label = _U('rent'), value = 'rent'})
|
||||
table.insert(elements, {label = _U('rent'), value = 'rent'})
|
||||
end
|
||||
|
||||
table.insert(elements, {label = _U('visit'), value = 'visit'})
|
||||
@@ -595,8 +595,7 @@ function OpenRoomInventoryMenu(property, owner)
|
||||
|
||||
else
|
||||
|
||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'get_item_count',
|
||||
{
|
||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'get_item_count', {
|
||||
title = _U('amount'),
|
||||
}, function(data2, menu)
|
||||
|
||||
|
||||
+4
-19
@@ -1,5 +1,4 @@
|
||||
ESX = nil
|
||||
local hasSqlRun = false
|
||||
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
|
||||
@@ -48,25 +47,10 @@ function RemoveOwnedProperty(name, owner)
|
||||
end)
|
||||
end
|
||||
|
||||
AddEventHandler('onMySQLReady', function()
|
||||
hasSqlRun = true
|
||||
LoadSql()
|
||||
end)
|
||||
|
||||
-- extremely useful when restarting script mid-game
|
||||
Citizen.CreateThread(function()
|
||||
Citizen.Wait(20000) -- hopefully enough for connection to the SQL server
|
||||
|
||||
if not hasSqlRun then
|
||||
LoadSql()
|
||||
hasSqlRun = true
|
||||
end
|
||||
end)
|
||||
|
||||
function LoadSql()
|
||||
MySQL.ready(function()
|
||||
MySQL.Async.fetchAll('SELECT * FROM properties', {}, function(properties)
|
||||
for i=1, #properties, 1 do
|
||||
|
||||
for i=1, #properties, 1 do
|
||||
local entering = nil
|
||||
local exit = nil
|
||||
local inside = nil
|
||||
@@ -133,7 +117,8 @@ function LoadSql()
|
||||
|
||||
TriggerClientEvent('esx_property:sendProperties', -1, Config.Properties)
|
||||
end)
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_property:getProperties', function(source, cb)
|
||||
cb(Config.Properties)
|
||||
|
||||
Reference in New Issue
Block a user