From d5b980e43a304e61366b9af641e72c9ce618ec2b Mon Sep 17 00:00:00 2001 From: Comet1903 Date: Tue, 26 Dec 2023 02:29:48 +0100 Subject: [PATCH 1/5] Add custom fines and ability to remove fines --- client/main.lua | 75 ++++++++++++++++++++++++++++++++++++++----------- config.lua | 3 ++ locales/cs.lua | 3 ++ locales/de.lua | 3 ++ locales/en.lua | 3 ++ locales/es.lua | 3 ++ locales/fi.lua | 3 ++ locales/fr.lua | 3 ++ locales/hu.lua | 3 ++ locales/it.lua | 3 ++ locales/nl.lua | 3 ++ locales/pl.lua | 3 ++ locales/sr.lua | 3 ++ server/main.lua | 5 ++++ 14 files changed, 100 insertions(+), 16 deletions(-) diff --git a/client/main.lua b/client/main.lua index 5ea172e..5e0eab8 100644 --- a/client/main.lua +++ b/client/main.lua @@ -507,23 +507,29 @@ function OpenBodySearchMenu(player) end function OpenFineMenu(player) - local elements = { - {unselectable = true, icon = "fas fa-scroll", title = TranslateCap('fine')}, - {icon = "fas fa-scroll", title = TranslateCap('traffic_offense'), value = 0}, - {icon = "fas fa-scroll", title = TranslateCap('minor_offense'), value = 1}, - {icon = "fas fa-scroll", title = TranslateCap('average_offense'), value = 2}, - {icon = "fas fa-scroll", title = TranslateCap('major_offense'), value = 3} - } - - ESX.OpenContext("right", elements, function(menu,element) - local data = {current = element} - OpenFineCategoryMenu(player, data.current.value) - end) + if Config.EnableFinePresets then + local elements = { + {unselectable = true, icon = "fas fa-scroll", title = TranslateCap('fine')}, + {icon = "fas fa-scroll", title = TranslateCap('traffic_offense'), value = 0}, + {icon = "fas fa-scroll", title = TranslateCap('minor_offense'), value = 1}, + {icon = "fas fa-scroll", title = TranslateCap('average_offense'), value = 2}, + {icon = "fas fa-scroll", title = TranslateCap('major_offense'), value = 3} + } + + ESX.OpenContext("right", elements, function(menu,element) + local data = {current = element} + OpenFineCategoryMenu(player, data.current.value) + end) + else + ESX.CloseContext() + ESX.CloseContext() + OpenFineTextInput(player) + end end local fineList = {} function OpenFineCategoryMenu(player, category) -if not fineList[category] then + if not fineList[category] then local p = promise.new() ESX.TriggerServerCallback('esx_policejob:getFineList', function(fines) @@ -531,7 +537,7 @@ if not fineList[category] then end, category) fineList[category] = Citizen.Await(p) -end + end local elements = { {unselectable = true, icon = "fas fa-scroll", title = TranslateCap('fine')} @@ -561,6 +567,39 @@ end end) end +function OpenFineTextInput(player) + Citizen.CreateThread(function() + local amount = 0 + local reason = '' + AddTextEntry('FMMC_KEY_TIP1', TranslateCap('fine_enter_amount')) + Citizen.Wait(0) + DisplayOnscreenKeyboard(1, 'FMMC_KEY_TIP1', '', '', '', '', '', 30) + while UpdateOnscreenKeyboard() ~= 1 and UpdateOnscreenKeyboard() ~= 2 do + Citizen.Wait(0) + end + if UpdateOnscreenKeyboard() ~= 2 then + amount = tonumber(GetOnscreenKeyboardResult()) + if amount == nil then + ESX.ShowNotification(TranslateCap('not_a_number')) + return + end + end + AddTextEntry('FMMC_KEY_TIP1', TranslateCap('fine_enter_text')) + Citizen.Wait(0) + DisplayOnscreenKeyboard(1, 'FMMC_KEY_TIP1', '', '', '', '', '', 120) + while UpdateOnscreenKeyboard() ~= 1 and UpdateOnscreenKeyboard() ~= 2 do + Citizen.Wait(0) + end + if UpdateOnscreenKeyboard() ~= 2 then + reason = GetOnscreenKeyboardResult() + end + Citizen.Wait(500) + TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(player), 'society_police', reason, amount) + OpenPoliceActionsMenu() + end) +end + + function LookupVehicle(elementF) local elements = { {unselectable = true, icon = "fas fa-car", title = elementF.title}, @@ -634,14 +673,18 @@ function OpenUnpaidBillsMenu(player) ESX.TriggerServerCallback('esx_billing:getTargetBills', function(bills) for k,bill in ipairs(bills) do elements[#elements+1] = { - unselectable = true, + unselectable = not Config.EnableFineRemoval, icon = "fas fa-scroll", title = ('%s - %s'):format(bill.label, TranslateCap('armory_item', ESX.Math.GroupDigits(bill.amount))), billId = bill.id } end - ESX.OpenContext("right", elements, nil, nil) + ESX.OpenContext('right', elements, function(menu, bill) + TriggerServerEvent('esx_policejob:removeFine', bill.billId) + ESX.CloseContext() + OpenUnpaidBillsMenu(player) + end, nil) end, GetPlayerServerId(player)) end diff --git a/config.lua b/config.lua index 9f94765..364fe12 100644 --- a/config.lua +++ b/config.lua @@ -20,6 +20,9 @@ Config.EnableCustomPeds = false -- Enable custom peds in cloak room? S Config.EnableESXService = false -- Enable esx service? Config.MaxInService = -1 -- How many people can be in service at once? Set as -1 to have no limit +Config.EnableFinePresets = true -- Set to false to use a custom input fields for fines +Config.EnableFineRemoval = true -- Enable to let officers remove fines + Config.Locale = GetConvar('esx:locale', 'en') Config.OxInventory = ESX.GetConfig().OxInventory diff --git a/locales/cs.lua b/locales/cs.lua index 2cc53c8..ef5b04d 100644 --- a/locales/cs.lua +++ b/locales/cs.lua @@ -85,6 +85,9 @@ Locales['cs'] = { ['licence_you_revoked'] = 'zrusil jsi %s ktery patril %s', ['no_players_nearby'] = 'zadny hrac pobliz!', ['being_searched'] = 'prave jsi prohledavan policii', + ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated + ['fine_enter_text'] = 'Enter the reason for the fine', --not translated + ['not_a_number'] = 'Error: Value was not a number', --not translated -- Vehicle interaction ['vehicle_info'] = 'informace o vozidle', ['pick_lock'] = 'vypáčit vozidlo', diff --git a/locales/de.lua b/locales/de.lua index 51c5ea7..8249faa 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -85,6 +85,9 @@ Locales['de'] = { ['licence_you_revoked'] = 'Du entziehst eine ~b~%s~s~ welche zu ~y~%s~s~ gehörte.', ['no_players_nearby'] = 'Es sind keine Personen in der Nähe!', ['being_searched'] = 'Du wirst von der Polizei durchsucht!', + ['fine_enter_amount'] = 'Gebe den Betrag der Geldstrafe ein', + ['fine_enter_text'] = 'Gebe den Grund der Geldstrafe ein', + ['not_a_number'] = 'Fehler: Die Eingabe muss eine Zahl sein', -- Vehicle interaction ['vehicle_info'] = 'Fahrzeug Info', ['pick_lock'] = 'Fahrzeug Aufbrechen', diff --git a/locales/en.lua b/locales/en.lua index 00262c2..93a9271 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -136,6 +136,9 @@ Locales['en'] = { ['average_offense'] = 'average Offense', ['major_offense'] = 'major Offense', ['fine_total'] = 'fine: %s', + ['fine_enter_amount'] = 'Enter the amount of the fine', + ['fine_enter_text'] = 'Enter the reason for the fine', + ['not_a_number'] = 'Error: Value was not a number', -- Vehicle Info Menu ['plate'] = 'plate: %s', ['owner_unknown'] = 'owner: Unknown', diff --git a/locales/es.lua b/locales/es.lua index 80c562a..ad37ad2 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -85,6 +85,9 @@ Locales['es'] = { ['licence_you_revoked'] = 'you revoked a %s which belonged to %s', ['no_players_nearby'] = 'no hay jugadores cerca', ['being_searched'] = 'you are being searched by the Police', + ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated + ['fine_enter_text'] = 'Enter the reason for the fine', --not translated + ['not_a_number'] = 'Error: Value was not a number', --not translated -- Vehicle interaction ['vehicle_info'] = 'Información del vehículo', ['pick_lock'] = 'Forzar coche', diff --git a/locales/fi.lua b/locales/fi.lua index 553d1e1..00a1d68 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -85,6 +85,9 @@ Locales['fi'] = { ['licence_you_revoked'] = 'sinä kumosit %s mikä kuului henkilölle %s', ['no_players_nearby'] = 'ei pelaajia lähettyvillä', ['being_searched'] = 'you are being searched by the Police', + ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated + ['fine_enter_text'] = 'Enter the reason for the fine', --not translated + ['not_a_number'] = 'Error: Value was not a number', --not translated -- Vehicle interaction ['vehicle_info'] = 'ajoneuvon tiedot', ['pick_lock'] = 'tiirikoi ovet', diff --git a/locales/fr.lua b/locales/fr.lua index ad151d4..70720bd 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -85,6 +85,9 @@ Locales['fr'] = { ['licence_you_revoked'] = 'vous avez révoqué un %s qui appartenait à %s', ['no_players_nearby'] = 'aucun joueur à proximité', ['being_searched'] = 'vous êtes recherché(e) par la Police', + ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated + ['fine_enter_text'] = 'Enter the reason for the fine', --not translated + ['not_a_number'] = 'Error: Value was not a number', --not translated -- Intéraction véhicule ['vehicle_info'] = 'infos véhicule', ['pick_lock'] = 'crocheter véhicule', diff --git a/locales/hu.lua b/locales/hu.lua index 7153441..5de9498 100644 --- a/locales/hu.lua +++ b/locales/hu.lua @@ -85,6 +85,9 @@ Locales['hu'] = { ['licence_you_revoked'] = 'visszavonta %s %s engedélyét', ['no_players_nearby'] = 'nincs a közeledben játékos!', ['being_searched'] = 'Téged éppen megmotoztak!', + ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated + ['fine_enter_text'] = 'Enter the reason for the fine', --not translated + ['not_a_number'] = 'Error: Value was not a number', --not translated -- Vehicle interaction ['vehicle_info'] = 'Jármü infó', ['pick_lock'] = 'Jármü feltörése', diff --git a/locales/it.lua b/locales/it.lua index e7983fc..d924da2 100644 --- a/locales/it.lua +++ b/locales/it.lua @@ -85,6 +85,9 @@ Locales['it'] = { ['licence_you_revoked'] = 'hai revocato una %s che apparteneva a %s', ['no_players_nearby'] = 'non ci sono giocatori nelle vicinanze!', ['being_searched'] = 'stai venendo perquisito dalla Polizia', + ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated + ['fine_enter_text'] = 'Enter the reason for the fine', --not translated + ['not_a_number'] = 'Error: Value was not a number', --not translated -- Interazione veicolo ['vehicle_info'] = 'informazioni sul veicolo', ['pick_lock'] = 'forza la serratura del veicolo', diff --git a/locales/nl.lua b/locales/nl.lua index 71d063c..01606c5 100644 --- a/locales/nl.lua +++ b/locales/nl.lua @@ -85,6 +85,9 @@ Locales['nl'] = { ['licence_you_revoked'] = 'Je hebt een %s van %s ingevorderd.', ['no_players_nearby'] = 'Geen spelers in de buurt!', ['being_searched'] = 'Je wordt gefouilleerd door de Politie', + ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated + ['fine_enter_text'] = 'Enter the reason for the fine', --not translated + ['not_a_number'] = 'Error: Value was not a number', --not translated -- Voertuig Interactie ['vehicle_info'] = 'Voertuig Informatie', ['pick_lock'] = 'Breek voertuig open', diff --git a/locales/pl.lua b/locales/pl.lua index 8360302..f603185 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -85,6 +85,9 @@ Locales['pl'] = { ['licence_you_revoked'] = 'unieważniasz %s które należały do %s', ['no_players_nearby'] = 'brak graczy w pobliżu', ['being_searched'] = 'you are being searched by the Police', + ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated + ['fine_enter_text'] = 'Enter the reason for the fine', --not translated + ['not_a_number'] = 'Error: Value was not a number', --not translated -- Vehicle interaction ['vehicle_info'] = 'informacje o pojeździe', ['pick_lock'] = 'odblokuj pojazd', diff --git a/locales/sr.lua b/locales/sr.lua index 2e2d11b..c54e276 100644 --- a/locales/sr.lua +++ b/locales/sr.lua @@ -129,6 +129,9 @@ Locales['sr'] = { ['average_offense'] = 'Prosečan prekršaj', ['major_offense'] = 'Veliki prekršaj', ['fine_total'] = 'kazna: %s', + ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated + ['fine_enter_text'] = 'Enter the reason for the fine', --not translated + ['not_a_number'] = 'Error: Value was not a number', --not translated -- Vehicle Info Menu ['plate'] = 'Tablice: %s', ['owner_unknown'] = 'Vlasnik: Nepoznat', diff --git a/server/main.lua b/server/main.lua index 117aac0..617aac1 100644 --- a/server/main.lua +++ b/server/main.lua @@ -211,6 +211,11 @@ ESX.RegisterServerCallback('esx_policejob:getFineList', function(source, cb, cat end end) +RegisterNetEvent('esx_policejob:removeFine') +AddEventHandler('esx_policejob:removeFine', function(id) + MySQL.update('DELETE FROM billing WHERE id = ?', {id}) +end) + ESX.RegisterServerCallback('esx_policejob:getVehicleInfos', function(source, cb, plate) local retrivedInfo = { plate = plate From ee28ef1c972b69686942b0b4d1ed38a7d66b631a Mon Sep 17 00:00:00 2001 From: Gellipapa Date: Mon, 22 Jan 2024 23:13:12 +0100 Subject: [PATCH 2/5] :memo: Update locales, and added new invalid_amount key --- locales/cs.lua | 2 +- locales/de.lua | 2 +- locales/en.lua | 2 +- locales/es.lua | 2 +- locales/fi.lua | 2 +- locales/fr.lua | 2 +- locales/hu.lua | 6 +++--- locales/it.lua | 2 +- locales/nl.lua | 2 +- locales/pl.lua | 2 +- locales/sr.lua | 6 +++--- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/locales/cs.lua b/locales/cs.lua index ef5b04d..71c46ec 100644 --- a/locales/cs.lua +++ b/locales/cs.lua @@ -87,7 +87,7 @@ Locales['cs'] = { ['being_searched'] = 'prave jsi prohledavan policii', ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated ['fine_enter_text'] = 'Enter the reason for the fine', --not translated - ['not_a_number'] = 'Error: Value was not a number', --not translated + ['invalid_amount'] = 'Error: Amount was not a number or invalid', --not translated -- Vehicle interaction ['vehicle_info'] = 'informace o vozidle', ['pick_lock'] = 'vypáčit vozidlo', diff --git a/locales/de.lua b/locales/de.lua index 8249faa..68c0992 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -87,7 +87,7 @@ Locales['de'] = { ['being_searched'] = 'Du wirst von der Polizei durchsucht!', ['fine_enter_amount'] = 'Gebe den Betrag der Geldstrafe ein', ['fine_enter_text'] = 'Gebe den Grund der Geldstrafe ein', - ['not_a_number'] = 'Fehler: Die Eingabe muss eine Zahl sein', + ['invalid_amount'] = 'Error: Amount was not a number or invalid', --not translated -- Vehicle interaction ['vehicle_info'] = 'Fahrzeug Info', ['pick_lock'] = 'Fahrzeug Aufbrechen', diff --git a/locales/en.lua b/locales/en.lua index 93a9271..505a1d4 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -138,7 +138,7 @@ Locales['en'] = { ['fine_total'] = 'fine: %s', ['fine_enter_amount'] = 'Enter the amount of the fine', ['fine_enter_text'] = 'Enter the reason for the fine', - ['not_a_number'] = 'Error: Value was not a number', + ['invalid_amount'] = 'Error: Amount was not a number or invalid', -- Vehicle Info Menu ['plate'] = 'plate: %s', ['owner_unknown'] = 'owner: Unknown', diff --git a/locales/es.lua b/locales/es.lua index ad37ad2..7baaf11 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -87,7 +87,7 @@ Locales['es'] = { ['being_searched'] = 'you are being searched by the Police', ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated ['fine_enter_text'] = 'Enter the reason for the fine', --not translated - ['not_a_number'] = 'Error: Value was not a number', --not translated + ['invalid_amount'] = 'Error: Amount was not a number or invalid', --not translated -- Vehicle interaction ['vehicle_info'] = 'Información del vehículo', ['pick_lock'] = 'Forzar coche', diff --git a/locales/fi.lua b/locales/fi.lua index 00a1d68..219c7d5 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -87,7 +87,7 @@ Locales['fi'] = { ['being_searched'] = 'you are being searched by the Police', ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated ['fine_enter_text'] = 'Enter the reason for the fine', --not translated - ['not_a_number'] = 'Error: Value was not a number', --not translated + ['invalid_amount'] = 'Error: Amount was not a number or invalid', --not translated -- Vehicle interaction ['vehicle_info'] = 'ajoneuvon tiedot', ['pick_lock'] = 'tiirikoi ovet', diff --git a/locales/fr.lua b/locales/fr.lua index 70720bd..ebb91d7 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -87,7 +87,7 @@ Locales['fr'] = { ['being_searched'] = 'vous êtes recherché(e) par la Police', ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated ['fine_enter_text'] = 'Enter the reason for the fine', --not translated - ['not_a_number'] = 'Error: Value was not a number', --not translated + ['invalid_amount'] = 'Error: Amount was not a number or invalid', --not translated -- Intéraction véhicule ['vehicle_info'] = 'infos véhicule', ['pick_lock'] = 'crocheter véhicule', diff --git a/locales/hu.lua b/locales/hu.lua index 5de9498..8d9f95a 100644 --- a/locales/hu.lua +++ b/locales/hu.lua @@ -85,9 +85,9 @@ Locales['hu'] = { ['licence_you_revoked'] = 'visszavonta %s %s engedélyét', ['no_players_nearby'] = 'nincs a közeledben játékos!', ['being_searched'] = 'Téged éppen megmotoztak!', - ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated - ['fine_enter_text'] = 'Enter the reason for the fine', --not translated - ['not_a_number'] = 'Error: Value was not a number', --not translated + ['fine_enter_amount'] = 'Írja be a bírság összegét', + ['fine_enter_text'] = 'Adja meg a bírság okát', + ['invalid_amount'] = 'Hiba: Az összeg nem szám vagy érvénytelen', -- Vehicle interaction ['vehicle_info'] = 'Jármü infó', ['pick_lock'] = 'Jármü feltörése', diff --git a/locales/it.lua b/locales/it.lua index d924da2..08b0297 100644 --- a/locales/it.lua +++ b/locales/it.lua @@ -87,7 +87,7 @@ Locales['it'] = { ['being_searched'] = 'stai venendo perquisito dalla Polizia', ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated ['fine_enter_text'] = 'Enter the reason for the fine', --not translated - ['not_a_number'] = 'Error: Value was not a number', --not translated + ['invalid_amount'] = 'Error: Amount was not a number or invalid', --not translated -- Interazione veicolo ['vehicle_info'] = 'informazioni sul veicolo', ['pick_lock'] = 'forza la serratura del veicolo', diff --git a/locales/nl.lua b/locales/nl.lua index 01606c5..bbf24bc 100644 --- a/locales/nl.lua +++ b/locales/nl.lua @@ -87,7 +87,7 @@ Locales['nl'] = { ['being_searched'] = 'Je wordt gefouilleerd door de Politie', ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated ['fine_enter_text'] = 'Enter the reason for the fine', --not translated - ['not_a_number'] = 'Error: Value was not a number', --not translated + ['invalid_amount'] = 'Error: Amount was not a number or invalid', --not translated -- Voertuig Interactie ['vehicle_info'] = 'Voertuig Informatie', ['pick_lock'] = 'Breek voertuig open', diff --git a/locales/pl.lua b/locales/pl.lua index f603185..f3b2331 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -87,7 +87,7 @@ Locales['pl'] = { ['being_searched'] = 'you are being searched by the Police', ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated ['fine_enter_text'] = 'Enter the reason for the fine', --not translated - ['not_a_number'] = 'Error: Value was not a number', --not translated + ['invalid_amount'] = 'Error: Amount was not a number or invalid', --not translated -- Vehicle interaction ['vehicle_info'] = 'informacje o pojeździe', ['pick_lock'] = 'odblokuj pojazd', diff --git a/locales/sr.lua b/locales/sr.lua index c54e276..964ebc8 100644 --- a/locales/sr.lua +++ b/locales/sr.lua @@ -129,9 +129,9 @@ Locales['sr'] = { ['average_offense'] = 'Prosečan prekršaj', ['major_offense'] = 'Veliki prekršaj', ['fine_total'] = 'kazna: %s', - ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated - ['fine_enter_text'] = 'Enter the reason for the fine', --not translated - ['not_a_number'] = 'Error: Value was not a number', --not translated + ['fine_enter_amount'] = 'Enter the amount of the fine', --not translated + ['fine_enter_text'] = 'Enter the reason for the fine', --not translated + ['invalid_amount'] = 'Error: Amount was not a number or invalid', --not translated -- Vehicle Info Menu ['plate'] = 'Tablice: %s', ['owner_unknown'] = 'Vlasnik: Nepoznat', From 0123d4aade59a94bccfe88446032f8437a9d3997 Mon Sep 17 00:00:00 2001 From: Gellipapa Date: Mon, 22 Jan 2024 23:14:23 +0100 Subject: [PATCH 3/5] :fire: Deleted remove bills options in config --- config.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config.lua b/config.lua index 364fe12..377f226 100644 --- a/config.lua +++ b/config.lua @@ -20,8 +20,7 @@ Config.EnableCustomPeds = false -- Enable custom peds in cloak room? S Config.EnableESXService = false -- Enable esx service? Config.MaxInService = -1 -- How many people can be in service at once? Set as -1 to have no limit -Config.EnableFinePresets = true -- Set to false to use a custom input fields for fines -Config.EnableFineRemoval = true -- Enable to let officers remove fines +Config.EnableFinePresets = false -- Set to false to use a custom input fields for fines Config.Locale = GetConvar('esx:locale', 'en') From cb47fbe2a8b6c973d2f1503afdbe3b51739d79d6 Mon Sep 17 00:00:00 2001 From: Gellipapa Date: Mon, 22 Jan 2024 23:15:17 +0100 Subject: [PATCH 4/5] :bug: Handle invalid amount, and change notify translate key --- client/main.lua | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/client/main.lua b/client/main.lua index 5e0eab8..c7e9f1c 100644 --- a/client/main.lua +++ b/client/main.lua @@ -579,8 +579,8 @@ function OpenFineTextInput(player) end if UpdateOnscreenKeyboard() ~= 2 then amount = tonumber(GetOnscreenKeyboardResult()) - if amount == nil then - ESX.ShowNotification(TranslateCap('not_a_number')) + if amount == nil or amount <= 0 then + ESX.ShowNotification(TranslateCap('invalid_amount')) return end end @@ -673,18 +673,15 @@ function OpenUnpaidBillsMenu(player) ESX.TriggerServerCallback('esx_billing:getTargetBills', function(bills) for k,bill in ipairs(bills) do elements[#elements+1] = { - unselectable = not Config.EnableFineRemoval, + unselectable = true, icon = "fas fa-scroll", title = ('%s - %s'):format(bill.label, TranslateCap('armory_item', ESX.Math.GroupDigits(bill.amount))), billId = bill.id } end - ESX.OpenContext('right', elements, function(menu, bill) - TriggerServerEvent('esx_policejob:removeFine', bill.billId) - ESX.CloseContext() - OpenUnpaidBillsMenu(player) - end, nil) + ESX.OpenContext("right", elements, nil, nil) + end, GetPlayerServerId(player)) end From ef0a67d3d969fed1dedba25635d4116f6f31ba86 Mon Sep 17 00:00:00 2001 From: Gellipapa Date: Mon, 22 Jan 2024 23:16:11 +0100 Subject: [PATCH 5/5] :fire: Deleted remove bills event from server side --- server/main.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/server/main.lua b/server/main.lua index 617aac1..7545fc3 100644 --- a/server/main.lua +++ b/server/main.lua @@ -211,10 +211,6 @@ ESX.RegisterServerCallback('esx_policejob:getFineList', function(source, cb, cat end end) -RegisterNetEvent('esx_policejob:removeFine') -AddEventHandler('esx_policejob:removeFine', function(id) - MySQL.update('DELETE FROM billing WHERE id = ?', {id}) -end) ESX.RegisterServerCallback('esx_policejob:getVehicleInfos', function(source, cb, plate) local retrivedInfo = {