mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
feat(esx_property): Save Properties on an interval
This commit is contained in:
@@ -8,6 +8,7 @@ Config.OwnedBlips = true -- Add blips for Owned Properties
|
||||
--------------------- General Settings ---------------------------------
|
||||
Config.Locale = 'en'
|
||||
Config.Shells = false -- Enable/Disable Shell Interiors Default: false
|
||||
Config.SaveInterval = 5 -- Interval in Minutes to Save Properties
|
||||
Config.CanAlwaysExit = true -- Disabling this allows players to be locked in
|
||||
Config.OwnerCanAlwaysEnter = true -- Disabling this means the owner can't enter the property unless door is unlocked
|
||||
Config.MaxNameLength = 20 -- Max Name Length for Owned Properties Default: 20
|
||||
|
||||
@@ -1109,3 +1109,15 @@ AddEventHandler('onResourceStop', function(ResourceName)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Save Properties every x Minutes
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
Wait(60000 * Config.SaveInterval)
|
||||
if Properties and #Properties > 0 then
|
||||
SaveResourceFile(GetCurrentResourceName(), 'properties.json', json.encode(Properties))
|
||||
Log("Properties Saving", 11141375, {{name = "**Reason**", value = "Interval Saving", inline = true},
|
||||
{name = "**Property Count**", value = tostring(#Properties), inline = true}}, 1)
|
||||
end
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user