mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 02:08:55 +00:00
Fixed restarting scripts no blips, closes #15
This commit is contained in:
+19
-26
@@ -24,6 +24,25 @@ local CurrentActionData = {}
|
||||
local FirstSpawn = true
|
||||
local HasChest = false
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while ESX == nil do
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx_property:sendProperties')
|
||||
AddEventHandler('esx_property:sendProperties', function(properties)
|
||||
Config.Properties = properties
|
||||
CreateBlips()
|
||||
|
||||
ESX.TriggerServerCallback('esx_property:getOwnedProperties', function(ownedProperties)
|
||||
for i=1, #ownedProperties, 1 do
|
||||
SetPropertyOwned(ownedProperties[i], true)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
function DrawSub(text, time)
|
||||
ClearPrints()
|
||||
SetTextEntry_2('STRING')
|
||||
@@ -857,17 +876,6 @@ AddEventHandler('playerSpawned', function()
|
||||
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:playerLoaded')
|
||||
AddEventHandler('esx:playerLoaded', function(xPlayer)
|
||||
PlayerLoaded = true
|
||||
|
||||
ESX.TriggerServerCallback('esx_property:getOwnedProperties', function(ownedProperties)
|
||||
for i=1, #ownedProperties, 1 do
|
||||
SetPropertyOwned(ownedProperties[i], true)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
AddEventHandler('esx_property:getProperties', function(cb)
|
||||
cb(GetProperties())
|
||||
end)
|
||||
@@ -961,21 +969,6 @@ AddEventHandler('esx_property:hasExitedMarker', function(name, part)
|
||||
CurrentAction = nil
|
||||
end)
|
||||
|
||||
-- Init
|
||||
Citizen.CreateThread(function()
|
||||
|
||||
while ESX == nil do
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
|
||||
ESX.TriggerServerCallback('esx_property:getProperties', function(properties)
|
||||
Config.Properties = properties
|
||||
CreateBlips()
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
-- Display markers
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
|
||||
+3
-5
@@ -159,7 +159,9 @@ function LoadSql()
|
||||
roomMenu = roomMenu,
|
||||
price = properties[i].price
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
TriggerClientEvent('esx_property:broadcastProperties', -1, Config.Properties)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -415,10 +417,6 @@ AddEventHandler('esx_property:putItem', function(owner, type, item, count)
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_property:getProperties', function(source, cb)
|
||||
cb(Config.Properties)
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_property:getOwnedProperties', function(source, cb)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
Reference in New Issue
Block a user