diff --git a/[esx]/es_extended/server/classes/player.lua b/[esx]/es_extended/server/classes/player.lua index 32ad4e12..071cce15 100644 --- a/[esx]/es_extended/server/classes/player.lua +++ b/[esx]/es_extended/server/classes/player.lua @@ -109,7 +109,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, function self.getAccount(account) for i=1, #self.accounts do if self.accounts[i].name == account then - return self.accounts[i], i + return self.accounts[i] end end end @@ -177,11 +177,11 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, return end if money >= 0 then - local account, index = self.getAccount(accountName) + local account = self.getAccount(accountName) if account then money = account.round and ESX.Math.Round(money) or money - self.accounts[index].money = money + self.accounts[account.index].money = money self.triggerEvent('esx:setAccountMoney', account) else @@ -198,10 +198,10 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, return end if money > 0 then - local account, index = self.getAccount(accountName) + local account = self.getAccount(accountName) if account then money = account.round and ESX.Math.Round(money) or money - self.accounts[index].money += money + self.accounts[account.index].money += money self.triggerEvent('esx:setAccountMoney', account) else @@ -218,11 +218,11 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, return end if money > 0 then - local account, index = self.getAccount(accountName) + local account = self.getAccount(accountName) if account then money = account.round and ESX.Math.Round(money) or money - self.accounts[index].money -= money + self.accounts[account.index].money -= money self.triggerEvent('esx:setAccountMoney', account) else diff --git a/[esx]/es_extended/server/main.lua b/[esx]/es_extended/server/main.lua index 7ca0a701..2a46a02f 100644 --- a/[esx]/es_extended/server/main.lua +++ b/[esx]/es_extended/server/main.lua @@ -131,8 +131,14 @@ function loadESXPlayer(identifier, playerId, isNew) if data.round == nil then data.round = true end - userData.accounts[#userData.accounts + 1] = {name = account, money = foundAccounts[account] or Config.StartingAccountMoney[account] or 0, - label = data.label, round = data.round} + local index = #userData.accounts + 1 + userData.accounts[index] = { + name = account, + money = foundAccounts[account] or Config.StartingAccountMoney[account] or 0, + label = data.label, + round = data.round, + index = index + } end -- Job diff --git a/[esx]/esx_menu_list/client/main.lua b/[esx]/esx_menu_list/client/main.lua index 9cd27f91..65721d0f 100644 --- a/[esx]/esx_menu_list/client/main.lua +++ b/[esx]/esx_menu_list/client/main.lua @@ -12,11 +12,7 @@ CreateThread(function() name = name, data = data }) - - ESX.SetTimeout(200, function() - SetNuiFocus(true, true) - end) - + SetNuiFocus(true, true) end local function closeMenu(namespace, name) @@ -46,11 +42,9 @@ CreateThread(function() RegisterNUICallback('menu_submit', function(data, cb) local menu = ESX.UI.Menu.GetOpened(MenuType, data._namespace, data._name) - - if menu.submit ~= nil then + if menu.submit then menu.submit(data, menu) end - cb('OK') end) diff --git a/[esx]/esx_menu_list/html/js/app.js b/[esx]/esx_menu_list/html/js/app.js index 943e2db8..fd113858 100644 --- a/[esx]/esx_menu_list/html/js/app.js +++ b/[esx]/esx_menu_list/html/js/app.js @@ -122,6 +122,7 @@ let menu = $(Mustache.render(MenuTpl, view)); menu.find('button[data-namespace][data-name]').click(function() { + ESX_MENU.data[$(this).data('namespace')][$(this).data('name')][parseInt($(this).data('id'))].currentRow = parseInt($(this).data('id')) + 1; ESX_MENU.submit($(this).data('namespace'), $(this).data('name'), { data : ESX_MENU.data[$(this).data('namespace')][$(this).data('name')][parseInt($(this).data('id'))], value: $(this).data('value') diff --git a/[esx_addons]/esx_jobs/client/main.lua b/[esx_addons]/esx_jobs/client/main.lua index e322c6c4..6699ed67 100644 --- a/[esx_addons]/esx_jobs/client/main.lua +++ b/[esx_addons]/esx_jobs/client/main.lua @@ -361,7 +361,7 @@ CreateThread(function() ESX.ShowHelpNotification(v.Hint) hintIsShowed = true if IsControlJustReleased(0, 38) then - ESX.Game.Teleport(PlayerPedId(), position) + ESX.Game.Teleport(PlayerPedId(), v.Teleport) end end end diff --git a/[esx_addons]/esx_policejob/locales/nl.lua b/[esx_addons]/esx_policejob/locales/nl.lua index 0cbfacb4..c8511feb 100644 --- a/[esx_addons]/esx_policejob/locales/nl.lua +++ b/[esx_addons]/esx_policejob/locales/nl.lua @@ -100,6 +100,7 @@ Locales['nl'] = { ['box'] = 'Box', ['fence'] = 'PD Hek', ['cash'] = 'Pallet met geld', + ['spikestrips'] = 'Spijkermatten', -- ID Menu ['name'] = 'Naam: %s', ['job'] = 'Werk: %s', diff --git a/[esx_addons]/esx_property/client/main.lua b/[esx_addons]/esx_property/client/main.lua index 1f5cc274..0712ff7e 100644 --- a/[esx_addons]/esx_property/client/main.lua +++ b/[esx_addons]/esx_property/client/main.lua @@ -877,7 +877,7 @@ function OpenPMQuickMenu(Action) end ESX.RegisterInput(_U("realestate_command"), _U("realestate_command_desc"), "keyboard", "F5", function() - ESX.TriggerServerCallback('esx_property:IsAdmin', function(Access) + ESX.TriggerServerCallback('esx_property:CanAccessRealEstateMenu', function(Access) if Access then OpenPMQuickMenu("ActionsMenu") end diff --git a/[esx_addons]/esx_property/config.lua b/[esx_addons]/esx_property/config.lua index 13fd373c..9cbe598d 100644 --- a/[esx_addons]/esx_property/config.lua +++ b/[esx_addons]/esx_property/config.lua @@ -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 diff --git a/[esx_addons]/esx_property/locales/en.lua b/[esx_addons]/esx_property/locales/en.lua index 031fba23..50d4de9c 100644 --- a/[esx_addons]/esx_property/locales/en.lua +++ b/[esx_addons]/esx_property/locales/en.lua @@ -194,4 +194,11 @@ Locales['en'] = { ["cctv_textui_3"] = "Press ~b~[E]~s~ to Set Max Left Roation", ["create_success"] = "Property created!", ["missing_data"] = "Please Fill Out all Required Inputs!", + + -- Saving Translations + ["server_restart"] = "Server Restarting", + ["server_shutdown"] = "Server Shutdown", + ["manual_save"] = "Manual Save (Requested By %s)", + ["resource_stop"] = "Resource Stopping", + ["interval_saving"] = "Interval Saving" } diff --git a/[esx_addons]/esx_property/server/main.lua b/[esx_addons]/esx_property/server/main.lua index 0b7397fb..440ad971 100644 --- a/[esx_addons]/esx_property/server/main.lua +++ b/[esx_addons]/esx_property/server/main.lua @@ -165,12 +165,6 @@ ESX.RegisterCommand(_("refresh_name"), Config.AllowedGroups, function(xPlayer) PropertiesRefresh() end, false, {help = _U("refresh_desc")}) -ESX.RegisterCommand(_("save_name"), Config.AllowedGroups, function(xPlayer) - SaveResourceFile(GetCurrentResourceName(), 'properties.json', json.encode(Properties)) - Log("Properties Saving", 11141375, - {{name = "**Reason**", value = "Requsted By Admin", inline = true}, {name = "**Property Count**", value = tostring(#Properties), inline = true}}, 1) -end, false,{help = _U("save_desc")}) - ESX.RegisterCommand(_("create_name"), "user", function(xPlayer) if IsPlayerAdmin(xPlayer.source) or (PM.Enabled and xPlayer.job.name == PM.job) then xPlayer.triggerEvent("esx_property:CreateProperty") @@ -1031,7 +1025,7 @@ AddEventHandler('playerDropped', function() end end) -ESX.RegisterServerCallback('esx_property:CanCreateProperty', function(source, cb, num) +ESX.RegisterServerCallback('esx_property:CanCreateProperty', function(source, cb) local Re = false local xPlayer = ESX.GetPlayerFromId(source) @@ -1044,10 +1038,16 @@ ESX.RegisterServerCallback('esx_property:CanCreateProperty', function(source, cb cb(Re) end) -ESX.RegisterServerCallback('esx_property:IsAdmin', function(source, cb, num) +ESX.RegisterServerCallback('esx_property:IsAdmin', function(source, cb) cb(IsPlayerAdmin(source, "ViewProperties")) end) +ESX.RegisterServerCallback('esx_property:CanAccessRealEstateMenu', function(source, cb) + local xPlayer = ESX.GetPlayerFromId(source) + local Re = (Config.PlayerManagement.Enabled and xPlayer.job.name == Config.PlayerManagement.job and xPlayer.job.grade >= Config.PlayerManagement.Permissions.ManagePropertiesFromQuickActions) and true or false + cb(Re) +end) + RegisterNetEvent('esx_property:server:createProperty', function(Property) local source = source local xPlayer = ESX.GetPlayerFromId(source) @@ -1088,24 +1088,36 @@ AddEventHandler('txAdmin:events:scheduledRestart', function(eventData) end end) ---- Save Properties On Server Stop/Restart -AddEventHandler('txAdmin:events:serverShuttingDown', function() +function PropertySave(Reason) if Properties and #Properties > 0 then SaveResourceFile(GetCurrentResourceName(), 'properties.json', json.encode(Properties)) Log("Properties Saving", 11141375, - {{name = "**Reason**", value = "Server Shutdown", inline = true}, {name = "**Property Count**", value = tostring(#Properties), inline = true}}, 1) + {{name = "**Reason**", value = Reason, inline = true}, {name = "**Property Count**", value = tostring(#Properties), inline = true}}, 1) end +end + +--- Save Properties On Server Stop/Restart +AddEventHandler('txAdmin:events:serverShuttingDown', function() + PropertySave(_U("server_shutdown")) end) --- Save Properties On Resource Stop/Restart AddEventHandler('onResourceStop', function(ResourceName) if ResourceName == GetCurrentResourceName() then - if Properties and #Properties > 0 then - SaveResourceFile(GetCurrentResourceName(), 'properties.json', json.encode(Properties)) - Log("Properties Saving", 11141375, {{name = "**Reason**", value = "Resource Restart", inline = true}, - {name = "**Property Count**", value = tostring(#Properties), inline = true}}, 1) - end + PropertySave(_U("resource_stop")) end end) +-- Save Properties every x Minutes + +CreateThread(function() + while true do + Wait(60000 * Config.SaveInterval) + PropertySave(_U("interval_save")) + end +end) + +ESX.RegisterCommand(_("save_name"), Config.AllowedGroups, function(xPlayer) + PropertySave(_U("manual_save", GetPlayerName(xPlayer.source))) +end, false,{help = _U("save_desc")}) diff --git a/server.cfg b/server.cfg index 3904cdf4..25824af0 100644 --- a/server.cfg +++ b/server.cfg @@ -24,8 +24,8 @@ sv_licenseKey "" sv_maxclients 10 # Allow access to features usually locked behind a FiveM patreon key sets sv_projectName "ESX Legacy" -sets sv_projectDesc "" -sets locale "en-GB" +sets sv_projectDesc "My new ESX Legacy project" +sets locale "en-US" sets tags "default, esx, legacy, Roleplay" sv_scriptHookAllowed 0