mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
fixes for society and police
This commit is contained in:
@@ -158,7 +158,7 @@ self.Init = function()
|
||||
|
||||
end
|
||||
|
||||
-- Helicopters
|
||||
-- Helicopters
|
||||
for i=1, #station.Helicopters, 1 do
|
||||
|
||||
local heli = station.Helicopters[i]
|
||||
@@ -194,6 +194,52 @@ self.Init = function()
|
||||
|
||||
end
|
||||
|
||||
-- Boss actions
|
||||
for i=1, #station.BossActions, 1 do
|
||||
|
||||
local actions = station.BossActions[i]
|
||||
local key = 'job_police:' .. stationName .. ':bossactions:' .. tostring(i)
|
||||
|
||||
Interact.Register({
|
||||
name = key,
|
||||
type = 'marker',
|
||||
distance = self.Config.DrawDistance,
|
||||
radius = 2.0,
|
||||
pos = actions,
|
||||
size = 1.0,
|
||||
mtype = 22,
|
||||
color = self.Config.MarkerColor,
|
||||
rotate = true,
|
||||
check = self.IsPoliceBoss,
|
||||
})
|
||||
|
||||
AddEventHandler('esx:interact:enter:' .. key, function(data)
|
||||
|
||||
ESX.ShowHelpNotification(_U('job_police:open_bossmenu'))
|
||||
|
||||
local bossAction
|
||||
|
||||
bossAction = function()
|
||||
|
||||
TriggerEvent('esx_society:openBossMenu', 'police', function(data, menu)
|
||||
menu.close()
|
||||
self.CurrentAction = bossAction
|
||||
end, {
|
||||
wash = false
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
self.CurrentAction = bossAction
|
||||
|
||||
end)
|
||||
|
||||
AddEventHandler('esx:interact:exit:' .. key, function(data)
|
||||
self.CurrentAction = nil
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -207,7 +253,11 @@ self.RegisterControls = function()
|
||||
end
|
||||
|
||||
self.IsPolice = function(playerPed, coords)
|
||||
return ESX.PlayerData.job and ESX.PlayerData.job.name == 'police'
|
||||
return ESX.PlayerData.job and (ESX.PlayerData.job.name == 'police')
|
||||
end
|
||||
|
||||
self.IsPoliceBoss = function(playerPed, coords)
|
||||
return self.IsPolice() and (ESX.PlayerData.job.grade_name == 'boss')
|
||||
end
|
||||
|
||||
self.CleanPlayer = function(playerPed)
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
USE `es_extended`;
|
||||
|
||||
INSERT INTO `addon_account` (name, label, shared) VALUES
|
||||
('society_police', 'Police', 1)
|
||||
;
|
||||
|
||||
INSERT INTO `datastore` (name, label, shared) VALUES
|
||||
('society_police', 'Police', 1)
|
||||
;
|
||||
|
||||
INSERT INTO `addon_inventory` (name, label, shared) VALUES
|
||||
('society_police', 'Police', 1)
|
||||
;
|
||||
|
||||
INSERT INTO `jobs` (name, label) VALUES
|
||||
('police', 'LSPD')
|
||||
;
|
||||
|
||||
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',3,'lieutenant','Lieutenant',85,'{}','{}'),
|
||||
('police',4,'boss','Commandant',100,'{}','{}')
|
||||
;
|
||||
|
||||
CREATE TABLE `fine_types` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`label` varchar(255) DEFAULT NULL,
|
||||
`amount` int(11) DEFAULT NULL,
|
||||
`category` int(11) DEFAULT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
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)
|
||||
;
|
||||
@@ -1,5 +1,9 @@
|
||||
local self = ESX.Modules['job_police']
|
||||
|
||||
AddEventHandler('esx:migrations:ensure', function(register)
|
||||
register('job_police')
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx_policejob:confiscatePlayerItem')
|
||||
AddEventHandler('esx_policejob:confiscatePlayerItem', function(target, itemType, itemName, amount)
|
||||
local _source = source
|
||||
|
||||
@@ -149,9 +149,9 @@ self.OpenBossMenu = function(society, close, options)
|
||||
menu2.close()
|
||||
end)
|
||||
elseif data.current.value == 'manage_employees' then
|
||||
OpenManageEmployeesMenu(society)
|
||||
self.OpenManageEmployeesMenu(society)
|
||||
elseif data.current.value == 'manage_grades' then
|
||||
OpenManageGradesMenu(society)
|
||||
self.OpenManageGradesMenu(society)
|
||||
end
|
||||
end, function(data, menu)
|
||||
if close then
|
||||
@@ -171,9 +171,9 @@ self.OpenManageEmployeesMenu = function(society)
|
||||
{label = _U('society:recruit'), value = 'recruit'}
|
||||
}}, function(data, menu)
|
||||
if data.current.value == 'employee_list' then
|
||||
OpenEmployeeList(society)
|
||||
self.OpenEmployeeList(society)
|
||||
elseif data.current.value == 'recruit' then
|
||||
OpenRecruitMenu(society)
|
||||
self.OpenRecruitMenu(society)
|
||||
end
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
@@ -206,17 +206,17 @@ self.OpenEmployeeList = function(society)
|
||||
|
||||
if data.value == 'promote' then
|
||||
menu.close()
|
||||
OpenPromoteMenu(society, employee)
|
||||
self.OpenPromoteMenu(society, employee)
|
||||
elseif data.value == 'fire' then
|
||||
ESX.ShowNotification(_U('society:you_have_fired', employee.name))
|
||||
|
||||
ESX.TriggerServerCallback('esx_society:setJob', function()
|
||||
OpenEmployeeList(society)
|
||||
self.OpenEmployeeList(society)
|
||||
end, employee.identifier, 'unemployed', 0, 'fire')
|
||||
end
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
OpenManageEmployeesMenu(society)
|
||||
self.OpenManageEmployeesMenu(society)
|
||||
end)
|
||||
end, society)
|
||||
end
|
||||
@@ -254,7 +254,7 @@ self.OpenRecruitMenu = function(society)
|
||||
ESX.ShowNotification(_U('society:you_have_hired', data.current.name))
|
||||
|
||||
ESX.TriggerServerCallback('esx_society:setJob', function()
|
||||
OpenRecruitMenu(society)
|
||||
self.OpenRecruitMenu(society)
|
||||
end, data.current.identifier, society, 0, 'hire')
|
||||
end
|
||||
end, function(data2, menu2)
|
||||
@@ -324,7 +324,7 @@ self.OpenManageGradesMenu = function(society)
|
||||
|
||||
if amount == nil then
|
||||
ESX.ShowNotification(_U('society:invalid_amount'))
|
||||
elseif amount > Config.MaxSalary then
|
||||
elseif amount > self.Config.MaxSalary then
|
||||
ESX.ShowNotification(_U('society:invalid_amount_max'))
|
||||
else
|
||||
menu2.close()
|
||||
|
||||
@@ -250,7 +250,7 @@ ESX.RegisterServerCallback('esx_society:setJobSalary', function(source, cb, job,
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
if xPlayer.job.name == job and xPlayer.job.grade_name == 'boss' then
|
||||
if salary <= Config.MaxSalary then
|
||||
if salary <= self.Config.MaxSalary then
|
||||
MySQL.Async.execute('UPDATE job_grades SET salary = @salary WHERE job_name = @job_name AND grade = @grade', {
|
||||
['@salary'] = salary,
|
||||
['@job_name'] = job,
|
||||
@@ -306,7 +306,7 @@ ESX.RegisterServerCallback('esx_society:getVehiclesInGarage', function(source, c
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_society:isBoss', function(source, cb, job)
|
||||
cb(isPlayerBoss(source, job))
|
||||
cb(self.isPlayerBoss(source, job))
|
||||
end)
|
||||
|
||||
MySQL.ready(function()
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
ESX.Modules['society'] = {}
|
||||
local self = ESX.Modules['society']
|
||||
|
||||
self.Config = ESX.EvalFile(GetCurrentResourceName(), 'modules/society/data/config.lua', {
|
||||
vector3 = vector3
|
||||
})['Config']
|
||||
|
||||
self.Jobs = {}
|
||||
self.RegisteredSocieties = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user