From 74ab2ff0356d22581fa90f3446393591c938e0db Mon Sep 17 00:00:00 2001 From: Mycroft Date: Thu, 24 Nov 2022 01:45:25 +0000 Subject: [PATCH 01/15] feat(es_extended): Basic Statebags --- [esx]/es_extended/server/classes/player.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/[esx]/es_extended/server/classes/player.lua b/[esx]/es_extended/server/classes/player.lua index c50b7c00..73634829 100644 --- a/[esx]/es_extended/server/classes/player.lua +++ b/[esx]/es_extended/server/classes/player.lua @@ -19,6 +19,12 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, if Config.Multichar then self.license = 'license'.. identifier:sub(identifier:find(':'), identifier:len()) else self.license = 'license:'..identifier end ExecuteCommand(('add_principal identifier.%s group.%s'):format(self.license, self.group)) + + Player(self.source).state:set("identifier", self.identifier, true) + Player(self.source).state:set("license", self.license, true) + Player(self.source).state:set("job", self.job, true) + Player(self.source).state:set("group", self.group, true) + Player(self.source).state:set("name", self.name, true) function self.triggerEvent(eventName, ...) TriggerClientEvent(eventName, self.source, ...) @@ -78,6 +84,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, function self.setGroup(newGroup) ExecuteCommand(('remove_principal identifier.%s group.%s'):format(self.license, self.group)) self.group = newGroup + Player(self.source).state:set("group", self.group, true) ExecuteCommand(('add_principal identifier.%s group.%s'):format(self.license, self.group)) end @@ -87,6 +94,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, function self.set(k, v) self.variables[k] = v + Player(self.source).state:set(k, v, true) end function self.get(k) @@ -170,6 +178,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, function self.setName(newName) self.name = newName + Player(self.source).state:set("name", self.name, true) end function self.setAccountMoney(accountName, money, reason) @@ -360,6 +369,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, TriggerEvent('esx:setJob', self.source, self.job, lastJob) self.triggerEvent('esx:setJob', self.job) + Player(self.source).state:set("job", self.job, true) else print(('[es_extended] [^3WARNING^7] Ignoring invalid ^5.setJob()^7 usage for ID: ^5%s^7, Job: ^5%s^7'):format(self.source, job)) end From 45e931c1034389ecbb950c19d66f83c9b9bf7518 Mon Sep 17 00:00:00 2001 From: Mycroft Date: Thu, 24 Nov 2022 01:48:38 +0000 Subject: [PATCH 02/15] fix(es_extended): Fix Vehicle Spawning --- [esx]/es_extended/client/main.lua | 4 ++++ [esx]/es_extended/server/onesync.lua | 32 +++++++++++++--------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/[esx]/es_extended/client/main.lua b/[esx]/es_extended/client/main.lua index c7ce21af..b613f741 100644 --- a/[esx]/es_extended/client/main.lua +++ b/[esx]/es_extended/client/main.lua @@ -13,6 +13,10 @@ CreateThread(function() end end) +RegisterNetEvent("esx:requestModel", function(model) + ESX.Streaming.RequestModel(model) +end) + RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin) ESX.PlayerData = xPlayer diff --git a/[esx]/es_extended/server/onesync.lua b/[esx]/es_extended/server/onesync.lua index 424f6ea8..67a629d1 100644 --- a/[esx]/es_extended/server/onesync.lua +++ b/[esx]/es_extended/server/onesync.lua @@ -62,23 +62,21 @@ end ---@param Properties table ---@param cb function function ESX.OneSync.SpawnVehicle(model, coords, heading, Properties, cb) - model = type(model) == 'string' and joaat(model) or model - Properties = Properties or {} - local vector = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z) - CreateThread(function() - local player = nil - for _, playerId in ipairs(GetPlayers()) do - ESX.GetVehicleType(model, playerId, function(Type) - local SpawnedEntity = CreateVehicleServerSetter(model, Type, vector, heading) - Wait(250) - local NetworkId = NetworkGetNetworkIdFromEntity(SpawnedEntity) - Properties.NetId = NetworkId - Entity(SpawnedEntity).state:set('VehicleProperties', Properties, true) - cb(NetworkId) - end) - break - end - end) + model = type(model) == 'string' and joaat(model) or model + Properties = Properties or {} + local vector = type(coords) == "vector3" and coords or vec(coords.x, coords.y, coords.z) + TriggerClientEvent("esx:requestModel", -1, model) + CreateThread(function() + local xPlayer = ESX.OneSync.GetClosestPlayer(vector, 200) + ESX.GetVehicleType(model, xPlayer.id, function(Type) + local SpawnedEntity = CreateVehicleServerSetter(model, Type, vector, heading) + Wait(250) + local NetworkId = NetworkGetNetworkIdFromEntity(SpawnedEntity) + Properties.NetId = NetworkId + Entity(SpawnedEntity).state:set('VehicleProperties', Properties, true) + cb(NetworkId) + end) + end) end From b2be63f5f4a0697216365ea56adb3ce822eac79e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=20Gerg=C5=91?= <69343477+Rav3n95@users.noreply.github.com> Date: Thu, 24 Nov 2022 22:46:35 +0100 Subject: [PATCH 03/15] Fix of the recent fix --- [esx]/esx_textui/TextUI.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/[esx]/esx_textui/TextUI.lua b/[esx]/esx_textui/TextUI.lua index 2cc04528..578c9772 100644 --- a/[esx]/esx_textui/TextUI.lua +++ b/[esx]/esx_textui/TextUI.lua @@ -1,12 +1,12 @@ Debug = ESX.GetConfig().EnableDebug ----@param message any ----@param type string -local function TextUI(message, type) +---@param message string +---@param typ string +local function TextUI(message, typ) SendNUIMessage({ action = 'show', message = message and message or 'ESX-TextUI', - type = type ~= 0 and type or 'info' + type = type(typ) == "string" and typ or 'info' }) end From 9716580e7b70a3878d38c9bc4fb52606ce38caf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=20Gerg=C5=91?= <69343477+Rav3n95@users.noreply.github.com> Date: Thu, 24 Nov 2022 22:48:13 +0100 Subject: [PATCH 04/15] Refactoring peds --- [esx_addons]/esx_banking/client/main.lua | 100 ++++++----------------- [esx_addons]/esx_banking/config.lua | 2 +- [esx_addons]/esx_banking/fxmanifest.lua | 2 +- [esx_addons]/esx_banking/server/main.lua | 54 ++++++++---- 4 files changed, 65 insertions(+), 93 deletions(-) diff --git a/[esx_addons]/esx_banking/client/main.lua b/[esx_addons]/esx_banking/client/main.lua index 342eefb9..e87c5d55 100644 --- a/[esx_addons]/esx_banking/client/main.lua +++ b/[esx_addons]/esx_banking/client/main.lua @@ -1,9 +1,10 @@ -local PlayerData, ActivateBlips, Peds = {}, {}, {} +local ActivateBlips = {} local PlayerLoaded = true local isInMarker, isInAtmMarker, isInMenu, isMarkerShowed = false, false, false, false local _GetEntityCoords, _PlayerPedId -- Functions + -- Listen for keypress while player inside the marker local function Listen4Key() CreateThread(function() @@ -46,57 +47,6 @@ local function RemoveBlips() ActivateBlips = {} end --- Ped Handler -local function PedHandler(ids) - local tmpPeds = {} - - for _, id in pairs(ids) do - if not Peds[id] then - - if not HasModelLoaded(Config.Peds[id].Model) then - RequestModel(Config.Peds[id].Model) - Wait(100) - while not HasModelLoaded(Config.Peds[id].Model) do - Wait(10) - end - end - - local npc = CreatePed(6, Config.Peds[id].Model, Config.Peds[id].Position + vector4(0, 0, -1, 0), false, - false) - TaskStartScenarioInPlace(npc, Config.Peds[id].Scenario, 0, true) - SetEntityInvincible(npc, true) - SetEntityProofs(npc, true, true, true, true, true, true, 1, true) - SetBlockingOfNonTemporaryEvents(npc, true) - FreezeEntityPosition(npc, true) - SetPedDiesWhenInjured(npc, false) - SetEntityCanBeDamaged(npc, false) - SetPedCanRagdollFromPlayerImpact(npc, false) - SetPedCanRagdoll(npc, false) - SetEntityAsMissionEntity(npc, true, true) - SetEntityDynamic(npc, false) - Peds[id] = npc - end - end - - for id, handle in pairs(Peds) do - local del = true - - for i = 1, #ids do - - if ids[i] == id then - del = false - tmpPeds[id] = handle - end - end - - if del then - DeletePed(handle) - end - end - - Peds = tmpPeds -end - function OpenUi(atm) atm = atm or false isInMenu = true @@ -129,7 +79,7 @@ function OpenUi(atm) end local function CloseUi() - SetNuiFocus(false) + SetNuiFocus(false, false) isInMenu = false SendNUIMessage({ showMenu = false @@ -144,8 +94,7 @@ end local function ShowMarker(coord) CreateThread(function() while isMarkerShowed do - DrawMarker(20, coord.x, coord.y, coord.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.2, 0.2, 187, 255, 0, 255, - false, true, 2, nil, nil, false) + DrawMarker(20, coord.x, coord.y, coord.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.2, 0.2, 187, 255, 0, 255, false, true, 2, false, nil, nil, false) Wait(0) end end) @@ -159,19 +108,6 @@ local function StartThread() _PlayerPedId = PlayerPedId() _GetEntityCoords = GetEntityCoords(_PlayerPedId) - if Config.EnablePeds then - local closestPed = {} - - for i = 1, #Config.Peds do - local distance = #(_GetEntityCoords - Config.Peds[i].Position.xyz) - if distance <= Config.DrawMarker then - closestPed[#closestPed + 1] = i - end - end - - PedHandler(closestPed) - end - if IsPedOnFoot(PlayerPedId()) then local closestBank = {} @@ -261,6 +197,21 @@ RegisterNetEvent('esx_banking:closebanking', function() CloseUi() end) +RegisterNetEvent('esx_banking:PedHandler', function(netIdTable) + local npc + for i = 1, #netIdTable do + npc = NetworkGetEntityFromNetworkId(netIdTable[i]) + TaskStartScenarioInPlace(npc, Config.Peds[i].Scenario, 0, true) + SetEntityProofs(npc, true, true, true, true, true, true, true, true) + SetBlockingOfNonTemporaryEvents(npc, true) + FreezeEntityPosition(npc, true) + SetPedCanRagdollFromPlayerImpact(npc, false) + SetPedCanRagdoll(npc, false) + SetEntityAsMissionEntity(npc, true, true) + SetEntityDynamic(npc, false) + end +end) + RegisterNetEvent('esx_banking:updateMoneyInUI') AddEventHandler('esx_banking:updateMoneyInUI', function(doingType, bankMoney, money) SendNUIMessage({ @@ -275,23 +226,20 @@ end) -- Resource starting AddEventHandler('onResourceStart', function(resource) - if resource ~= GetCurrentResourceName() then - return - end + if resource ~= GetCurrentResourceName() then return end StartThread() end) -- Enables it on player loaded RegisterNetEvent('esx:playerLoaded', function() StartThread() - end) +end) + -- Resource stopping AddEventHandler('onResourceStop', function(resource) - if resource ~= GetCurrentResourceName() then - return - end + if resource ~= GetCurrentResourceName() then return end RemoveBlips() if isInMenu then CloseUi() end -end) +end) \ No newline at end of file diff --git a/[esx_addons]/esx_banking/config.lua b/[esx_addons]/esx_banking/config.lua index 6c6ba038..045d0276 100644 --- a/[esx_addons]/esx_banking/config.lua +++ b/[esx_addons]/esx_banking/config.lua @@ -2,7 +2,7 @@ Config = { Debug = false, DrawMarker = 10, Locale = GetConvar('esx:locale', 'en'), - EnablePeds = true, + EnablePeds = true, AtmModels = {`prop_fleeca_atm`, `prop_atm_01`, `prop_atm_02`, `prop_atm_03`}, Banks = { { diff --git a/[esx_addons]/esx_banking/fxmanifest.lua b/[esx_addons]/esx_banking/fxmanifest.lua index 25f0e83f..54d199bf 100644 --- a/[esx_addons]/esx_banking/fxmanifest.lua +++ b/[esx_addons]/esx_banking/fxmanifest.lua @@ -4,7 +4,7 @@ game 'gta5' description 'ESX banking' lua54 'yes' -version '1.8.5' +version '1.8.6' shared_scripts { '@es_extended/imports.lua', diff --git a/[esx_addons]/esx_banking/server/main.lua b/[esx_addons]/esx_banking/server/main.lua index 110c19d9..23ca5737 100644 --- a/[esx_addons]/esx_banking/server/main.lua +++ b/[esx_addons]/esx_banking/server/main.lua @@ -1,3 +1,5 @@ +local spawnedPeds, netIdTable = {}, {} + -- get keys utils local function get_key(t) local key @@ -9,28 +11,34 @@ end -- Resource starting AddEventHandler('onResourceStart', function(resourceName) - if (GetCurrentResourceName() ~= resourceName) then - return - end + if (GetCurrentResourceName() ~= resourceName) then return end + if Config.EnablePeds then BANK.CreatePeds() end local twoMonthMs = (os.time() - 5259487) * 1000 MySQL.Sync.fetchScalar('DELETE FROM banking WHERE time < ? ', {twoMonthMs}) end) +AddEventHandler('onResourceStop', function(resourceName) + if (GetCurrentResourceName() ~= resourceName) then return end + if Config.EnablePeds then BANK.DeletePeds() end +end) + +AddEventHandler('esx:playerLoaded', function(playerId, xPlayer) + if not Config.EnablePeds then return end + TriggerClientEvent('esx_banking:PedHandler', playerId, netIdTable) +end) + -- event RegisterServerEvent('esx_banking:doingType') AddEventHandler('esx_banking:doingType', function(typeData) - if source == nil then - return - end - if (typeData == nil) then - return - end + if source == nil then return end + if (typeData == nil) then return end local source = source local xPlayer = ESX.GetPlayerFromId(source) local identifier = xPlayer.getIdentifier() local money = xPlayer.getAccount('money').money local bankMoney = xPlayer.getAccount('bank').money + local amount local key = get_key(typeData) if typeData.deposit then @@ -43,9 +51,7 @@ AddEventHandler('esx_banking:doingType', function(typeData) amount = tonumber(typeData.pincode) end - if not tonumber(amount) then - return - end + if not tonumber(amount) then return end amount = ESX.Math.Round(amount) if amount == nil or (not typeData.pincode and amount <= 0) then @@ -116,6 +122,24 @@ end) -- bank functions BANK = { + CreatePeds = function() + for i = 1, #Config.Peds do + local model = Config.Peds[i].Model + local coords = Config.Peds[i].Position + spawnedPeds[i] = CreatePed(0, model, coords.x, coords.y, coords.z, coords.w, true, true) + netIdTable[i] = NetworkGetNetworkIdFromEntity(spawnedPeds[i]) + while not DoesEntityExist(spawnedPeds[i]) do Wait(50) end + end + + Wait(100) + TriggerClientEvent('esx_banking:PedHandler', -1, netIdTable) + end, + DeletePeds = function() + for i = 1, #spawnedPeds do + DeleteEntity(spawnedPeds[i]) + spawnedPeds[i] = nil + end + end, Withdraw = function(amount, xPlayer) xPlayer.addAccountMoney('money', amount) xPlayer.removeAccountMoney('bank', amount) @@ -132,7 +156,7 @@ BANK = { xPlayer.removeAccountMoney('bank', amount) xTarget.addAccountMoney('bank', amount) - bankMoney = xTarget.getAccount('bank').money + local bankMoney = xTarget.getAccount('bank').money BANK.LogTransaction(xTarget.source, "TRANSFER_RECEIVE", amount, bankMoney) TriggerClientEvent("esx:showNotification", xTarget.source, TranslateCap('receive_transfer', amount, xPlayer.source), "success") @@ -151,5 +175,5 @@ BANK = { MySQL.insert('INSERT INTO banking (identifier, type, amount, time, balance) VALUES (?, ?, ?, ?, ?)', {identifier, logType, amount, os.time() * 1000, bankMoney}) - end -} + end +} \ No newline at end of file From 8a73289a72a26537a8055834756068a1fc53f8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=20Gerg=C5=91?= <69343477+Rav3n95@users.noreply.github.com> Date: Thu, 24 Nov 2022 23:01:16 +0100 Subject: [PATCH 05/15] Update en.lua --- [esx_addons]/esx_allowlist/locales/en.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/[esx_addons]/esx_allowlist/locales/en.lua b/[esx_addons]/esx_allowlist/locales/en.lua index 55964780..96281f8d 100644 --- a/[esx_addons]/esx_allowlist/locales/en.lua +++ b/[esx_addons]/esx_allowlist/locales/en.lua @@ -1,5 +1,5 @@ Locales['en'] = { - ['allowlist_check'] = 'Checking you are Allowlisted.', + ['allowlist_check'] = 'Checking if you are Allowlisted.', ['not_allowlisted'] = 'You Must be Allowlisted to join this server!', ['allowlist_empty'] = 'There Are no allowlists saved for this server.', ['license_missing'] = 'Error: Your Identifier is missing!', From e615c570b815f4469a3daf9b82ea1c37084d3932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=20Gerg=C5=91?= <69343477+Rav3n95@users.noreply.github.com> Date: Thu, 24 Nov 2022 23:01:49 +0100 Subject: [PATCH 06/15] Fixed Hungarian locale --- [esx_addons]/esx_allowlist/locales/hu.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/[esx_addons]/esx_allowlist/locales/hu.lua b/[esx_addons]/esx_allowlist/locales/hu.lua index 294a2ede..7bd30405 100644 --- a/[esx_addons]/esx_allowlist/locales/hu.lua +++ b/[esx_addons]/esx_allowlist/locales/hu.lua @@ -1,8 +1,8 @@ Locales['hu'] = { - ['allowlist_check'] = 'Ellenőrzi, hogy fent vagy-e az engedélyezett listára.', + ['allowlist_check'] = 'Ellenőrizzük fent vagy-e a menők listáján.', ['not_allowlisted'] = 'Engedélyezettnek kell lenned ahhoz, hogy csatlakozz ehhez a szerverhez!', - ['allowlist_empty'] = 'Ehhez a szerverhez nincsenek mentett engedélyezési listák.', - ['license_missing'] = 'Hiba: Te Identifier-ed hiányzik!', - ['help_allowlist_add'] = 'jétékos felvéltele a allowlist-re', - ['help_allowlist_load'] = 'allowlist újratöltése', + ['allowlist_empty'] = 'Ehhez a szerverhez nincsenek mentett engedélyezési lista.', + ['license_missing'] = 'Hiba: Te azonosítód hiányzik!', + ['help_allowlist_add'] = 'játékos felvétele az engedélyezettek listájára', + ['help_allowlist_load'] = 'engedélyezési lista újratöltése', } From 28f5a377d151dd1a26434cd711b77c5367f71b15 Mon Sep 17 00:00:00 2001 From: GLN <48370836+GLN123@users.noreply.github.com> Date: Fri, 25 Nov 2022 00:01:12 +0100 Subject: [PATCH 07/15] esx_lscustom fix --- [esx_addons]/esx_lscustom/server/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/[esx_addons]/esx_lscustom/server/main.lua b/[esx_addons]/esx_lscustom/server/main.lua index ff03af3c..5879b7dc 100644 --- a/[esx_addons]/esx_lscustom/server/main.lua +++ b/[esx_addons]/esx_lscustom/server/main.lua @@ -79,7 +79,7 @@ AddEventHandler('esx_lscustom:refreshOwnedVehicle', function(vehicleProps) local vehicle = json.decode(result.vehicle) if vehicleProps.model == vehicle.model then MySQL.update('UPDATE owned_vehicles SET vehicle = ? WHERE plate = ?', {json.encode(vehicleProps), vehicleProps.plate}) - Customs[tostring(source)][tostring(vehicleProps.plate)].props = props + Customs[tostring(source)][tostring(vehicleProps.plate)].props = vehicleProps else print(('[^3WARNING^7] Player ^5%s^7 Attempted To upgrade with mismatching vehicle model'):format(xPlayer.source)) end From 5d4627fad6872aae8a85280e6360d43c8e86bc00 Mon Sep 17 00:00:00 2001 From: Gellipapa Date: Sat, 26 Nov 2022 01:37:26 +0100 Subject: [PATCH 08/15] fix undefined texts issue --- [esx_addons]/esx_banking/html/scripts/app.js | 1 + 1 file changed, 1 insertion(+) diff --git a/[esx_addons]/esx_banking/html/scripts/app.js b/[esx_addons]/esx_banking/html/scripts/app.js index 2cf8afe5..be6c105d 100644 --- a/[esx_addons]/esx_banking/html/scripts/app.js +++ b/[esx_addons]/esx_banking/html/scripts/app.js @@ -758,6 +758,7 @@ $(document).ready(function(){ if(data.openATM){ ATMRender() type = "ATM" + transaction.setData(transData,languageText) } else{ type = "BANK" From 6aea97a6babfb85bfc89e9f304e50afe66081227 Mon Sep 17 00:00:00 2001 From: Gellipapa Date: Sat, 26 Nov 2022 01:39:19 +0100 Subject: [PATCH 09/15] fix Italian translation errors --- [esx_addons]/esx_banking/html/config.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/[esx_addons]/esx_banking/html/config.json b/[esx_addons]/esx_banking/html/config.json index 0deac798..af9490cc 100644 --- a/[esx_addons]/esx_banking/html/config.json +++ b/[esx_addons]/esx_banking/html/config.json @@ -268,8 +268,8 @@ "LAUNGAGE": { "your_money_title":"saldo", "your_money_desc":"qui puoi vedere il saldo attuale e contanti.", - "your_money_cash":"i tuoi soldi", - "your_money_bank":"il tuo saldo bancario", + "your_money_cash_label":"i tuoi soldi", + "your_money_bank_label":"il tuo saldo bancario", "withdraw":"RITIRARE", "deposit":"DEPOSITARE", "transfer":"TRASFERIMENTO", @@ -289,7 +289,7 @@ "timeLabel":"tempo", "searchInputPlaceholder":"Cerca ...", "_comment": "tabella Opzioni complete della lingua: inglese, ungherese, italiana puoi trovare qui tutte le lingue: https://cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/", - "tableFullLanguage":"Italiano" + "tableFullLanguage":"Italian" } } } From 6eb915ba853e3e4bdd378aa44b6a62946fd93b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=20Gerg=C5=91?= Date: Sat, 26 Nov 2022 01:43:01 +0100 Subject: [PATCH 10/15] Fix paths --- [esx_addons]/esx_holdup/{ => locales}/it.lua | 0 [esx_addons]/esx_lscustom/{ => locales}/et.lua | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename [esx_addons]/esx_holdup/{ => locales}/it.lua (100%) rename [esx_addons]/esx_lscustom/{ => locales}/et.lua (100%) diff --git a/[esx_addons]/esx_holdup/it.lua b/[esx_addons]/esx_holdup/locales/it.lua similarity index 100% rename from [esx_addons]/esx_holdup/it.lua rename to [esx_addons]/esx_holdup/locales/it.lua diff --git a/[esx_addons]/esx_lscustom/et.lua b/[esx_addons]/esx_lscustom/locales/et.lua similarity index 100% rename from [esx_addons]/esx_lscustom/et.lua rename to [esx_addons]/esx_lscustom/locales/et.lua From c55af609563b54d7b11a948315c9e180d761987a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3bert=20Nagy?= Date: Sat, 26 Nov 2022 01:43:56 +0100 Subject: [PATCH 11/15] fix(es_extended): GetVehicleProperties custom xenon color The first return parameter of GetVehicleXenonLightsCustomColor is a boolean indicating if the vehicle has custom color. --- [esx]/es_extended/client/functions.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/[esx]/es_extended/client/functions.lua b/[esx]/es_extended/client/functions.lua index f3882323..9210f240 100644 --- a/[esx]/es_extended/client/functions.lua +++ b/[esx]/es_extended/client/functions.lua @@ -676,9 +676,9 @@ function ESX.Game.GetVehicleProperties(vehicle) customPrimaryColor = {r, g, b} end - local customXenonColorR, customXenonColorG, customXenonColorB = GetVehicleXenonLightsCustomColor(vehicle) + local hasCustomXenonColor, customXenonColorR, customXenonColorG, customXenonColorB = GetVehicleXenonLightsCustomColor(vehicle) local customXenonColor = nil - if customXenonColorR and customXenonColorG and customXenonColorB then + if hasCustomXenonColor then customXenonColor = {customXenonColorR, customXenonColorG, customXenonColorB} end From f78af2710d0d664ed4369402a05c4a2ee30915e9 Mon Sep 17 00:00:00 2001 From: Gellipapa Date: Sat, 26 Nov 2022 02:29:50 +0100 Subject: [PATCH 12/15] add log transaction exports and fix typo --- [esx_addons]/esx_banking/server/main.lua | 36 ++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/[esx_addons]/esx_banking/server/main.lua b/[esx_addons]/esx_banking/server/main.lua index 23ca5737..d4a34243 100644 --- a/[esx_addons]/esx_banking/server/main.lua +++ b/[esx_addons]/esx_banking/server/main.lua @@ -120,6 +120,38 @@ ESX.RegisterServerCallback("esx_banking:checkPincode", function(source, cb, inpu cb(pincode > 0) end) +function logTransaction(targetSource,key,amount) + if targetSource == nil then + print("ERROR: TargetSource nil!") + return + end + + if key == nil then + print("ERROR: Do you need use these: WITHDRAW,DEPOSIT,TRANSFER_RECEIVE") + return + end + + if type(key) ~= "string" or key == '' then + print("ERROR: Do you need use these: WITHDRAW,DEPOSIT,TRANSFER_RECEIVE and can only be string type!") + return + end + + if amount == nil then + print("ERROR: Amount value is nil! Add some numeric value to the amount!") + return + end + + local xPlayer = ESX.GetPlayerFromId(tonumber(targetSource)) + + if xPlayer ~= nil then + local bankCurrentMoney = xPlayer.getAccount('bank').money + BANK.LogTransaction(targetSource, string.upper(key), amount, bankCurrentMoney) + else + print("ERROR: xPlayer is nil!") + end +end +exports("logTransaction", logTransaction) + -- bank functions BANK = { CreatePeds = function() @@ -167,7 +199,7 @@ BANK = { MySQL.update('UPDATE users SET pincode = ? WHERE identifier = ? ', {amount, identifier}) end, LogTransaction = function(playerId, logType, amount, bankMoney) - if source == nil then + if playerId == nil then return end local xPlayer = ESX.GetPlayerFromId(playerId) @@ -176,4 +208,4 @@ BANK = { MySQL.insert('INSERT INTO banking (identifier, type, amount, time, balance) VALUES (?, ?, ?, ?, ?)', {identifier, logType, amount, os.time() * 1000, bankMoney}) end -} \ No newline at end of file +} From 55374a795be5ca1c3b3dc6351ac4011c591bde1d Mon Sep 17 00:00:00 2001 From: Gellipapa Date: Sat, 26 Nov 2022 02:41:41 +0100 Subject: [PATCH 13/15] add readme how to use log transaction export --- [esx_addons]/esx_banking/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/[esx_addons]/esx_banking/README.md b/[esx_addons]/esx_banking/README.md index d2f2e791..bbe28230 100644 --- a/[esx_addons]/esx_banking/README.md +++ b/[esx_addons]/esx_banking/README.md @@ -29,6 +29,17 @@ ensure esx_banking Run the banking.sql into your database. Done. ``` +# If you want to create a bank log in another script, you can do it this way! Only server side! +``` +exports["esx_banking"]:logTransaction(source,logType,amount) + +- First param: source - player source +- Second param: logType - WITHDRAW,DEPOSIT,TRANSFER_RECEIVE you can only use these log types! +- Third param: amount - The amount to be logged + +For example: exports["esx_banking"]:logTransaction(source,"WITHDRAW",200) +``` + # Legal ### License esx_banking - banking script for ESX From 8cb620dfe1721c865ff2609503334e0f624ce8a7 Mon Sep 17 00:00:00 2001 From: Mycroft Date: Sat, 26 Nov 2022 17:12:39 +0000 Subject: [PATCH 14/15] fix(esx_textui): Correctly Fix TextUI fixes 'id' issue, also fixes the "TextUI Is not displaying!" issues :) --- [esx]/esx_textui/TextUI.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/[esx]/esx_textui/TextUI.lua b/[esx]/esx_textui/TextUI.lua index 2cc04528..37020fbc 100644 --- a/[esx]/esx_textui/TextUI.lua +++ b/[esx]/esx_textui/TextUI.lua @@ -1,16 +1,21 @@ Debug = ESX.GetConfig().EnableDebug - +local IsShowing = false ---@param message any ----@param type string +---@param Type string local function TextUI(message, type) + IsShowing = true SendNUIMessage({ action = 'show', message = message and message or 'ESX-TextUI', - type = type ~= 0 and type or 'info' + type = type == 0 and "info" or type }) end local function HideUI() + if not IsShowing then + return + end + IsShowing = false SendNUIMessage({ action = 'hide' }) From 18d054e0765ee251165c1029b289152b4bb98b79 Mon Sep 17 00:00:00 2001 From: Mycroft Date: Sat, 26 Nov 2022 17:15:05 +0000 Subject: [PATCH 15/15] feat(esx_joblisting): Actual Security This should in theory, stop the event from being abused, since mod menus were previously able to Trigger This event to set the user to a whitelisted job, assuming the user was near the job centre, so this now checks to make sure that the job is a non-whitelisted job, and warns when abused --- [esx_addons]/esx_joblisting/server/main.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/[esx_addons]/esx_joblisting/server/main.lua b/[esx_addons]/esx_joblisting/server/main.lua index 7be7b151..648c4c2b 100644 --- a/[esx_addons]/esx_joblisting/server/main.lua +++ b/[esx_addons]/esx_joblisting/server/main.lua @@ -14,6 +14,12 @@ ESX.RegisterServerCallback('esx_joblisting:getJobsList', function(source, cb) cb(jobs) end) +function IsJobAvailable(job) + local jobs = ESX.GetJobs() + local JobToCheck = jobs[job] + return not JobToCheck.whitelisted +end + function IsNearCentre(player) local Ped = GetPlayerPed(player) local PedCoords = GetEntityCoords(Ped) @@ -37,11 +43,13 @@ AddEventHandler('esx_joblisting:setJob', function(job) local xPlayer = ESX.GetPlayerFromId(source) local jobs = getJobs() - if xPlayer and IsNearCentre(source) then + if xPlayer and IsNearCentre(source) and IsJobAvailable(job) then if ESX.DoesJobExist(job, 0) then xPlayer.setJob(job, 0) else print("[^1ERROR^7] Tried Setting User ^5".. source .. "^7 To Invalid Job - ^5"..job .."^7!") end + else + print("[^3WARNING^7] User ^5".. source .. "^7 Attempted to Exploit ^5`esx_joblisting:setJob`^7!") end end)