diff --git a/client/main.lua b/client/main.lua
index 7993195..882a3bc 100644
--- a/client/main.lua
+++ b/client/main.lua
@@ -521,35 +521,44 @@ function OpenFineMenu(player)
end)
end
+local fineList = {}
function OpenFineCategoryMenu(player, category)
- ESX.TriggerServerCallback('esx_policejob:getFineList', function(fines)
- local elements = {
- {unselectable = true, icon = "fas fa-scroll", title = TranslateCap('fine')}
+if not fineList[category] then
+ local p = promise.new()
+
+ ESX.TriggerServerCallback('esx_policejob:getFineList', function(fines)
+ p:resolve(fines)
+ end, category)
+
+ fineList[category] = Citizen.Await(p)
+end
+
+ local elements = {
+ {unselectable = true, icon = "fas fa-scroll", title = TranslateCap('fine')}
+ }
+
+ for k,fine in ipairs(fineList[category]) do
+ elements[#elements+1] = {
+ icon = "fas fa-scroll",
+ title = ('%s %s'):format(fine.label, TranslateCap('armory_item', ESX.Math.GroupDigits(fine.amount))),
+ value = fine.id,
+ amount = fine.amount,
+ fineLabel = fine.label
}
+ end
- for k,fine in ipairs(fines) do
- elements[#elements+1] = {
- icon = "fas fa-scroll",
- title = ('%s %s'):format(fine.label, TranslateCap('armory_item', ESX.Math.GroupDigits(fine.amount))),
- value = fine.id,
- amount = fine.amount,
- fineLabel = fine.label
- }
+ ESX.OpenContext("right", elements, function(menu,element)
+ local data = {current = element}
+ if Config.EnablePlayerManagement then
+ TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(player), 'society_police', TranslateCap('fine_total', data.current.fineLabel), data.current.amount)
+ else
+ TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(player), '', TranslateCap('fine_total', data.current.fineLabel), data.current.amount)
end
- ESX.OpenContext("right", elements, function(menu,element)
- local data = {current = element}
- if Config.EnablePlayerManagement then
- TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(player), 'society_police', TranslateCap('fine_total', data.current.fineLabel), data.current.amount)
- else
- TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(player), '', TranslateCap('fine_total', data.current.fineLabel), data.current.amount)
- end
-
- ESX.SetTimeout(300, function()
- OpenFineCategoryMenu(player, category)
- end)
+ ESX.SetTimeout(300, function()
+ OpenFineCategoryMenu(player, category)
end)
- end, category)
+ end)
end
function LookupVehicle(elementF)
diff --git a/esx_policejob.sql b/esx_policejob.sql
index f82f90d..9f4267f 100644
--- a/esx_policejob.sql
+++ b/esx_policejob.sql
@@ -11,15 +11,15 @@ INSERT INTO `addon_inventory` (name, label, shared) VALUES
;
INSERT INTO `jobs` (name, label) VALUES
- ('police', 'LSPD')
+ ('police', 'Police')
;
INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES
- ('police',0,'recruit','Recrue',20,'{}','{}'),
- ('police',1,'officer','Officier',40,'{}','{}'),
- ('police',2,'sergeant','Sergent',60,'{}','{}'),
+ ('police',0,'recruit','Recruit',20,'{}','{}'),
+ ('police',1,'officer','Officer',40,'{}','{}'),
+ ('police',2,'sergeant','Sergeant',60,'{}','{}'),
('police',3,'lieutenant','Lieutenant',85,'{}','{}'),
- ('police',4,'boss','Commandant',100,'{}','{}')
+ ('police',4,'boss','Chief',100,'{}','{}')
;
CREATE TABLE `fine_types` (
@@ -33,56 +33,56 @@ CREATE TABLE `fine_types` (
INSERT INTO `fine_types` (label, amount, category) VALUES
- ('Usage abusif du klaxon',30,0),
- ('Franchir une ligne continue',40,0),
- ('Circulation à contresens',250,0),
- ('Demi-tour non autorisé',250,0),
- ('Circulation hors-route',170,0),
- ('Non-respect des distances de sécurité',30,0),
- ('Arrêt dangereux / interdit',150,0),
- ('Stationnement gênant / interdit',70,0),
- ('Non respect de la priorité à droite',70,0),
- ('Non-respect à un véhicule prioritaire',90,0),
- ('Non-respect d\'un stop',105,0),
- ('Non-respect d\'un feu rouge',130,0),
- ('Dépassement dangereux',100,0),
- ('Véhicule non en état',100,0),
- ('Conduite sans permis',1500,0),
- ('Délit de fuite',800,0),
- ('Excès de vitesse < 5 kmh',90,0),
- ('Excès de vitesse 5-15 kmh',120,0),
- ('Excès de vitesse 15-30 kmh',180,0),
- ('Excès de vitesse > 30 kmh',300,0),
- ('Entrave de la circulation',110,1),
- ('Dégradation de la voie publique',90,1),
- ('Trouble à l\'ordre publique',90,1),
- ('Entrave opération de police',130,1),
- ('Insulte envers / entre civils',75,1),
- ('Outrage à agent de police',110,1),
- ('Menace verbale ou intimidation envers civil',90,1),
- ('Menace verbale ou intimidation envers policier',150,1),
- ('Manifestation illégale',250,1),
- ('Tentative de corruption',1500,1),
- ('Arme blanche sortie en ville',120,2),
- ('Arme léthale sortie en ville',300,2),
- ('Port d\'arme non autorisé (défaut de license)',600,2),
- ('Port d\'arme illégal',700,2),
- ('Pris en flag lockpick',300,2),
- ('Vol de voiture',1800,2),
- ('Vente de drogue',1500,2),
- ('Fabriquation de drogue',1500,2),
- ('Possession de drogue',650,2),
- ('Prise d\'ôtage civil',1500,2),
- ('Prise d\'ôtage agent de l\'état',2000,2),
- ('Braquage particulier',650,2),
- ('Braquage magasin',650,2),
- ('Braquage de banque',1500,2),
- ('Tir sur civil',2000,3),
- ('Tir sur agent de l\'état',2500,3),
- ('Tentative de meurtre sur civil',3000,3),
- ('Tentative de meurtre sur agent de l\'état',5000,3),
- ('Meurtre sur civil',10000,3),
- ('Meurte sur agent de l\'état',30000,3),
- ('Meurtre involontaire',1800,3),
- ('Escroquerie à l\'entreprise',2000,2)
+ ('Misuse of a horn', 30, 0),
+ ('Illegally Crossing a continuous Line', 40, 0),
+ ('Driving on the wrong side of the road', 250, 0),
+ ('Illegal U-Turn', 250, 0),
+ ('Illegally Driving Off-road', 170, 0),
+ ('Refusing a Lawful Command', 30, 0),
+ ('Illegally Stopping a Vehicle', 150, 0),
+ ('Illegal Parking', 70, 0),
+ ('Failing to Yield to the right', 70, 0),
+ ('Failure to comply with Vehicle Information', 90, 0),
+ ('Failing to stop at a Stop Sign ', 105, 0),
+ ('Failing to stop at a Red Light', 130, 0),
+ ('Illegal Passing', 100, 0),
+ ('Driving an illegal Vehicle', 100, 0),
+ ('Driving without a License', 1500, 0),
+ ('Hit and Run', 800, 0),
+ ('Exceeding Speeds Over < 5 mph', 90, 0),
+ ('Exceeding Speeds Over 5-15 mph', 120, 0),
+ ('Exceeding Speeds Over 15-30 mph', 180, 0),
+ ('Exceeding Speeds Over > 30 mph', 300, 0),
+ ('Impeding traffic flow', 110, 1),
+ ('Public Intoxication', 90, 1),
+ ('Disorderly conduct', 90, 1),
+ ('Obstruction of Justice', 130, 1),
+ ('Insults towards Civilans', 75, 1),
+ ('Disrespecting of an LEO', 110, 1),
+ ('Verbal Threat towards a Civilan', 90, 1),
+ ('Verbal Threat towards an LEO', 150, 1),
+ ('Providing False Information', 250, 1),
+ ('Attempt of Corruption', 1500, 1),
+ ('Brandishing a weapon in city Limits', 120, 2),
+ ('Brandishing a Lethal Weapon in city Limits', 300, 2),
+ ('No Firearms License', 600, 2),
+ ('Possession of an Illegal Weapon', 700, 2),
+ ('Possession of Burglary Tools', 300, 2),
+ ('Grand Theft Auto', 1800, 2),
+ ('Intent to Sell/Distrube of an illegal Substance', 1500, 2),
+ ('Frabrication of an Illegal Substance', 1500, 2),
+ ('Possession of an Illegal Substance ', 650, 2),
+ ('Kidnapping of a Civilan', 1500, 2),
+ ('Kidnapping of an LEO', 2000, 2),
+ ('Robbery', 650, 2),
+ ('Armed Robbery of a Store', 650, 2),
+ ('Armed Robbery of a Bank', 1500, 2),
+ ('Assault on a Civilian', 2000, 3),
+ ('Assault of an LEO', 2500, 3),
+ ('Attempt of Murder of a Civilian', 3000, 3),
+ ('Attempt of Murder of an LEO', 5000, 3),
+ ('Murder of a Civilian', 10000, 3),
+ ('Murder of an LEO', 30000, 3),
+ ('Involuntary manslaughter', 1800, 3),
+ ('Fraud', 2000, 2);
;
diff --git a/server/main.lua b/server/main.lua
index ec0695a..117aac0 100644
--- a/server/main.lua
+++ b/server/main.lua
@@ -197,11 +197,18 @@ ESX.RegisterServerCallback('esx_policejob:getOtherPlayerData', function(source,
end
end)
+local fineList = {}
ESX.RegisterServerCallback('esx_policejob:getFineList', function(source, cb, category)
- MySQL.query('SELECT * FROM fine_types WHERE category = ?', {category},
- function(fines)
- cb(fines)
- end)
+ if not fineList[category] then
+ MySQL.query('SELECT * FROM fine_types WHERE category = ?', {category},
+ function(fines)
+ fineList[category] = fines
+
+ cb(fines)
+ end)
+ else
+ cb(fineList[category])
+ end
end)
ESX.RegisterServerCallback('esx_policejob:getVehicleInfos', function(source, cb, plate)