Merge pull request #28 from ESX-Org/feature/enhancement

Provides props regarding the grade of the player
This commit is contained in:
Jérémie N'gadi
2017-10-17 12:51:50 +02:00
committed by GitHub
2 changed files with 208 additions and 35 deletions
+197 -25
View File
@@ -51,28 +51,48 @@ end
function OpenCloakroomMenu()
local elements = {
{label = _U('citizen_wear'), value = 'citizen_wear'},
{label = _U('police_wear'), value = 'police_wear'}
{ label = _U('citizen_wear'), value = 'citizen_wear' }
}
ESX.UI.Menu.CloseAll()
if PlayerData.job.grade_name == 'recruit' then
table.insert(elements, {label = _U('cadet_wear'), value = 'cadet_wear'})
end
if Config.EnableNonFreemodePeds then
table.insert(elements, {label = _U('sheriff_wear'), value = 'sheriff_wear'})
if PlayerData.job.grade_name == 'officer' then
table.insert(elements, {label = _U('police_wear'), value = 'police_wear'})
end
if PlayerData.job.grade_name == 'sergeant' then
table.insert(elements, {label = _U('sergent_wear'), value = 'sergent_wear'})
end
if PlayerData.job.grade_name == 'lieutenant' then
table.insert(elements, {label = _U('lieutenant_wear'), value = 'lieutenant_wear'})
end
if PlayerData.job.grade_name == 'boss' then
table.insert(elements, {label = _U('commandant_wear'), value = 'commandant_wear'})
end
ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'cloakroom',
{
title = _U('cloakroom'),
align = 'top-left',
elements = elements,
},
if Config.EnableNonFreemodePeds then
table.insert(elements, {label = _U('sheriff_wear'), value = 'sheriff_wear_freemode'})
table.insert(elements, {label = _U('lieutenant_wear'), value = 'lieutenant_wear_freemode'})
table.insert(elements, {label = _U('commandant_wear'), value = 'commandant_wear_freemode'})
end
function(data, menu)
table.insert(elements, {label = _U('veste_wear'), value = 'veste_wear'})
table.insert(elements, {label = _U('gilet_wear'), value = 'gilet_wear'})
ESX.UI.Menu.CloseAll()
ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'cloakroom',
{
title = _U('cloakroom'),
align = 'top-left',
elements = elements,
},
function(data, menu)
menu.close()
--Taken from SuperCoolNinja
@@ -100,22 +120,136 @@ function OpenCloakroomMenu()
end)
end
if data.current.value == 'police_wear' then
if data.current.value == 'cadet_wear' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
if skin.sex == 0 then
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male)
SetPedComponentVariation(GetPlayerPed(-1), 3, 30, 0, 0) --Gants
SetPedComponentVariation(GetPlayerPed(-1), 4, 35, 0, 0) --Jean
SetPedComponentVariation(GetPlayerPed(-1), 6, 24, 0, 0) --Chaussure
SetPedComponentVariation(GetPlayerPed(-1), 8, 58, 0, 0) --mattraque
SetPedComponentVariation(GetPlayerPed(-1), 11, 55, 0, 0)--Veste
SetPedComponentVariation(GetPlayerPed(-1), 10, 8, 0, 0) --Grade
SetPedComponentVariation(GetPlayerPed(-1), 8, 59, 0, 0) --GiletJaune
SetPedComponentVariation(GetPlayerPed(-1), 5, 0, 0, 2) --Bag
SetPedPropIndex(GetPlayerPed(-1), 2, 2, 0, 1) --Oreillete
SetPedPropIndex(GetPlayerPed(-1), 6, 3, 0, 1) --Montre
ClearPedProp(GetPlayerPed(-1), 0) -- Helmet
else
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female)
end
end)
end
if data.current.value == 'sheriff_wear' then
if data.current.value == 'police_wear' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
if skin.sex == 0 then
SetPedComponentVariation(GetPlayerPed(-1), 3, 30, 0, 0)--Gants
SetPedComponentVariation(GetPlayerPed(-1), 4, 35, 0, 0)--Jean
SetPedComponentVariation(GetPlayerPed(-1), 6, 24, 0, 0)--Chaussure
SetPedComponentVariation(GetPlayerPed(-1), 8, 58, 0, 0)--mattraque
SetPedComponentVariation(GetPlayerPed(-1), 11, 55, 0, 0)--Veste
SetPedComponentVariation(GetPlayerPed(-1), 10, 8, 0, 0)--Grade
SetPedComponentVariation(GetPlayerPed(-1), 5, 0, 0, 2) --Bag
SetPedPropIndex(GetPlayerPed(-1), 2, 2, 0, 1)--Oreillete
SetPedPropIndex(GetPlayerPed(-1), 6, 3, 0, 1)--Montre
ClearPedProp(GetPlayerPed(-1), 0) -- Helmet
else
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female)
end
end)
end
if data.current.value == 'sergent_wear' then --Ajout de tenue par grades
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
if skin.sex == 0 then
SetPedComponentVariation(GetPlayerPed(-1), 3, 30, 0, 0)--Gants
SetPedComponentVariation(GetPlayerPed(-1), 4, 35, 0, 0)--Jean
SetPedComponentVariation(GetPlayerPed(-1), 6, 24, 0, 0)--Chaussure
SetPedComponentVariation(GetPlayerPed(-1), 8, 58, 0, 0)--mattraque
SetPedComponentVariation(GetPlayerPed(-1), 11, 55, 0, 0)--Veste
SetPedComponentVariation(GetPlayerPed(-1), 10, 8, 1, 0)--Grade
SetPedComponentVariation(GetPlayerPed(-1), 5, 0, 0, 2) --Bag
SetPedPropIndex(GetPlayerPed(-1), 2, 2, 0, 1)--Oreillete
SetPedPropIndex(GetPlayerPed(-1), 6, 3, 0, 1)--Montre
ClearPedProp(GetPlayerPed(-1), 0) -- Helmet
else
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female)
end
end)
end
if data.current.value == 'lieutenant_wear' then --Ajout de tenue par grades
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
if skin.sex == 0 then
SetPedComponentVariation(GetPlayerPed(-1), 3, 30, 0, 0)--Gants
SetPedComponentVariation(GetPlayerPed(-1), 4, 35, 0, 0)--Jean
SetPedComponentVariation(GetPlayerPed(-1), 6, 24, 0, 0)--Chaussure
SetPedComponentVariation(GetPlayerPed(-1), 8, 58, 0, 0)--mattraque
SetPedComponentVariation(GetPlayerPed(-1), 11, 55, 0, 0)--Veste
SetPedComponentVariation(GetPlayerPed(-1), 10, 8, 2, 0)--Grade
SetPedComponentVariation(GetPlayerPed(-1), 5, 0, 0, 2) --Bag
SetPedPropIndex(GetPlayerPed(-1), 2, 2, 0, 1)--Oreillete
SetPedPropIndex(GetPlayerPed(-1), 6, 3, 0, 1)--Montre
ClearPedProp(GetPlayerPed(-1), 0) -- Helmet
else
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female)
end
end)
end
if data.current.value == 'commandant_wear' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
if skin.sex == 0 then
SetPedComponentVariation(GetPlayerPed(-1), 3, 30, 0, 0)--Gants
SetPedComponentVariation(GetPlayerPed(-1), 4, 35, 0, 0)--Jean
SetPedComponentVariation(GetPlayerPed(-1), 6, 24, 0, 0)--Chaussure
SetPedComponentVariation(GetPlayerPed(-1), 8, 58, 0, 0)--mattraque
SetPedComponentVariation(GetPlayerPed(-1), 11, 55, 0, 0)--Veste
SetPedComponentVariation(GetPlayerPed(-1), 10, 8, 3, 0)--Grade
SetPedComponentVariation(GetPlayerPed(-1), 5, 0, 0, 2) --Bag
SetPedPropIndex(GetPlayerPed(-1), 2, 2, 0, 1)--Oreillete
SetPedPropIndex(GetPlayerPed(-1), 6, 3, 0, 1)--Montre
ClearPedProp(GetPlayerPed(-1), 0) -- Helmet
else
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female)
end
end)
end
if data.current.value == 'veste_wear' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function()
SetPedComponentVariation(GetPlayerPed(-1), 9, 10, 1, 2)--Gilet
local playerPed = GetPlayerPed(-1)
SetPedArmour(playerPed, 100)
ClearPedBloodDamage(playerPed)
ResetPedVisibleDamage(playerPed)
ClearPedLastWeaponDamage(playerPed)
end)
end
if data.current.value == 'veste_wear' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function()
SetPedComponentVariation(GetPlayerPed(-1), 9, 10, 1, 2)--Gilet
end)
end
if data.current.value == 'gilet_wear' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function()
SetPedComponentVariation(GetPlayerPed(-1), 9, 14, 1, 2)--Sans Gilet
local playerPed = GetPlayerPed(-1)
SetPedArmour(playerPed, 0)
ClearPedBloodDamage(playerPed)
ResetPedVisibleDamage(playerPed)
ClearPedLastWeaponDamage(playerPed)
end)
end
if data.current.value == 'sheriff_wear_freemode' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
if skin.sex == 0 then
@@ -146,7 +280,7 @@ function OpenCloakroomMenu()
end)
end
if data.current.value == 'lieutenant_wear' then
if data.current.value == 'lieutenant_wear_freemode' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
@@ -177,7 +311,7 @@ function OpenCloakroomMenu()
end)
end
if data.current.value == 'commandant_wear' then
if data.current.value == 'commandant_wear_freemode' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
@@ -375,9 +509,47 @@ function OpenVehicleSpawnerMenu(station, partNum)
local elements = {}
for i=1, #Config.PoliceStations[station].AuthorizedVehicles, 1 do
local vehicle = Config.PoliceStations[station].AuthorizedVehicles[i]
table.insert(elements, {label = vehicle.label, value = vehicle.name})
table.insert(elements, { label = 'Vélo', value = 'fixter' })
table.insert(elements, { label = 'Cruiser', value = 'police' })
table.insert(elements, { label = 'Sheriff Cruiser', value = 'sheriff' })
if PlayerData.job.grade_name == 'officer' then
table.insert(elements, { label = 'Interceptor', value = 'police3'})
end
if PlayerData.job.grade_name == 'sergean' then
table.insert(elements, { label = 'Sheriff SUV', value = 'sheriff2'})
table.insert(elements, { label = 'Interceptor', value = 'police3'})
table.insert(elements, { label = 'Buffalo', value = 'police2'})
table.insert(elements, { label = 'Moto', value = 'policeb'})
table.insert(elements, { label = 'Bus pénitentiaire', value = 'pbus'})
table.insert(elements, { label = 'Bus de transport', value = 'policet'})
table.insert(elements, { label = 'Antiémeute', value = 'riot'})
end
if PlayerData.job.grade_name == 'lieutenant' then
table.insert(elements, { label = 'Sheriff SUV', value = 'sheriff2'})
table.insert(elements, { label = 'Interceptor', value = 'police3'})
table.insert(elements, { label = 'Buffalo', value = 'police2'})
table.insert(elements, { label = 'Moto', value = 'policeb'})
table.insert(elements, { label = 'Bus pénitentiaire', value = 'pbus'})
table.insert(elements, { label = 'Bus de transport', value = 'policet'})
table.insert(elements, { label = 'Antiémeute', value = 'riot'})
table.insert(elements, { label = 'FBI', value = 'fbi'})
table.insert(elements, { label = 'FBI SUV', value = 'fbi2'})
end
if PlayerData.job.grade_name == 'boss' then
table.insert(elements, { label = 'Sheriff SUV', value = 'sheriff2'})
table.insert(elements, { label = 'Interceptor', value = 'police3'})
table.insert(elements, { label = 'Buffalo', value = 'police2'})
table.insert(elements, { label = 'Moto', value = 'policeb'})
table.insert(elements, { label = 'Bus pénitentiaire', value = 'pbus'})
table.insert(elements, { label = 'Bus de transport', value = 'policet'})
table.insert(elements, { label = 'Antiémeute', value = 'riot'})
table.insert(elements, { label = 'FBI', value = 'fbi'})
table.insert(elements, { label = 'FBI SUV', value = 'fbi2'})
table.insert(elements, { label = 'Voiture Banalisée ', value = 'police4'})
end
ESX.UI.Menu.Open(
+11 -10
View File
@@ -1,37 +1,38 @@
INSERT INTO `addon_account` (name, label, shared) VALUES
INSERT INTO `addon_account` (name, label, shared) VALUES
('society_police','Police',1)
;
INSERT INTO `datastore` (name, label, shared) VALUES
INSERT INTO `datastore` (name, label, shared) VALUES
('society_police','Police',1)
;
INSERT INTO `addon_inventory` (name, label, shared) VALUES
INSERT INTO `addon_inventory` (name, label, shared) VALUES
('society_police', 'Police', 1)
;
INSERT INTO `jobs` (name, label) VALUES
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,'{\"tshirt_1\":57,\"torso_1\":55,\"arms\":0,\"pants_1\":35,\"glasses\":0,\"decals_2\":0,\"hair_color_2\":0,\"helmet_2\":0,\"hair_color_1\":5,\"face\":19,\"glasses_2\":1,\"torso_2\":0,\"shoes\":24,\"hair_1\":2,\"skin\":34,\"sex\":0,\"glasses_1\":0,\"pants_2\":0,\"hair_2\":0,\"decals_1\":0,\"tshirt_2\":0,\"helmet_1\":8}','{\"tshirt_1\":34,\"torso_1\":48,\"shoes\":24,\"pants_1\":34,\"torso_2\":0,\"decals_2\":0,\"hair_color_2\":0,\"glasses\":0,\"helmet_2\":0,\"hair_2\":3,\"face\":21,\"decals_1\":0,\"glasses_2\":1,\"hair_1\":11,\"skin\":34,\"sex\":1,\"glasses_1\":5,\"pants_2\":0,\"arms\":14,\"hair_color_1\":10,\"tshirt_2\":0,\"helmet_1\":57}'),
('police',1,'sergeant','Sergent',40,'{\"tshirt_1\":58,\"torso_1\":55,\"shoes\":24,\"pants_1\":35,\"pants_2\":0,\"decals_2\":1,\"hair_color_2\":0,\"face\":19,\"helmet_2\":0,\"hair_2\":0,\"arms\":0,\"decals_1\":8,\"torso_2\":0,\"hair_1\":2,\"skin\":34,\"sex\":0,\"glasses_1\":0,\"glasses_2\":1,\"hair_color_1\":5,\"glasses\":0,\"tshirt_2\":0,\"helmet_1\":11}','{\"tshirt_1\":35,\"torso_1\":48,\"arms\":14,\"pants_1\":34,\"pants_2\":0,\"decals_2\":1,\"hair_color_2\":0,\"shoes\":24,\"helmet_2\":0,\"hair_2\":3,\"decals_1\":7,\"torso_2\":0,\"face\":21,\"hair_1\":11,\"skin\":34,\"sex\":1,\"glasses_1\":5,\"glasses_2\":1,\"hair_color_1\":10,\"glasses\":0,\"tshirt_2\":0,\"helmet_1\":57}'),
('police',2,'lieutenant','Lieutenant',65,'{\"tshirt_1\":58,\"torso_1\":55,\"shoes\":24,\"pants_1\":35,\"pants_2\":0,\"decals_2\":2,\"hair_color_2\":0,\"face\":19,\"helmet_2\":0,\"hair_2\":0,\"glasses\":0,\"decals_1\":8,\"hair_color_1\":5,\"hair_1\":2,\"skin\":34,\"sex\":0,\"glasses_1\":0,\"glasses_2\":1,\"torso_2\":0,\"arms\":41,\"tshirt_2\":0,\"helmet_1\":11}','{\"tshirt_1\":35,\"torso_1\":48,\"arms\":44,\"pants_1\":34,\"hair_2\":3,\"decals_2\":2,\"hair_color_2\":0,\"hair_color_1\":10,\"helmet_2\":0,\"face\":21,\"shoes\":24,\"torso_2\":0,\"glasses_2\":1,\"hair_1\":11,\"skin\":34,\"sex\":1,\"glasses_1\":5,\"pants_2\":0,\"decals_1\":7,\"glasses\":0,\"tshirt_2\":0,\"helmet_1\":57}'),
('police',3,'boss','Commandant',80,'{\"tshirt_1\":58,\"torso_1\":55,\"shoes\":24,\"pants_1\":35,\"pants_2\":0,\"decals_2\":3,\"hair_color_2\":0,\"face\":19,\"helmet_2\":0,\"hair_2\":0,\"arms\":41,\"torso_2\":0,\"hair_color_1\":5,\"hair_1\":2,\"skin\":34,\"sex\":0,\"glasses_1\":0,\"glasses_2\":1,\"decals_1\":8,\"glasses\":0,\"tshirt_2\":0,\"helmet_1\":11}','{\"tshirt_1\":35,\"torso_1\":48,\"arms\":44,\"pants_1\":34,\"pants_2\":0,\"decals_2\":3,\"hair_color_2\":0,\"face\":21,\"helmet_2\":0,\"hair_2\":3,\"decals_1\":7,\"torso_2\":0,\"hair_color_1\":10,\"hair_1\":11,\"skin\":34,\"sex\":1,\"glasses_1\":5,\"glasses_2\":1,\"shoes\":24,\"glasses\":0,\"tshirt_2\":0,\"helmet_1\":57}')
('police',4,'officer','Officier',40,'{\"tshirt_1\":58,\"torso_1\":55,\"shoes\":24,\"pants_1\":35,\"pants_2\":0,\"decals_2\":1,\"hair_color_2\":0,\"face\":19,\"helmet_2\":0,\"hair_2\":0,\"arms\":0,\"decals_1\":8,\"torso_2\":0,\"hair_1\":2,\"skin\":34,\"sex\":0,\"glasses_1\":0,\"glasses_2\":1,\"hair_color_1\":5,\"glasses\":0,\"tshirt_2\":0,\"helmet_1\":11}','{\"tshirt_1\":35,\"torso_1\":48,\"arms\":14,\"pants_1\":34,\"pants_2\":0,\"decals_2\":1,\"hair_color_2\":0,\"shoes\":24,\"helmet_2\":0,\"hair_2\":3,\"decals_1\":7,\"torso_2\":0,\"face\":21,\"hair_1\":11,\"skin\":34,\"sex\":1,\"glasses_1\":5,\"glasses_2\":1,\"hair_color_1\":10,\"glasses\":0,\"tshirt_2\":0,\"helmet_1\":57}'),
('police',1,'sergeant','Sergent',60,'{\"tshirt_1\":58,\"torso_1\":55,\"shoes\":24,\"pants_1\":35,\"pants_2\":0,\"decals_2\":1,\"hair_color_2\":0,\"face\":19,\"helmet_2\":0,\"hair_2\":0,\"arms\":0,\"decals_1\":8,\"torso_2\":0,\"hair_1\":2,\"skin\":34,\"sex\":0,\"glasses_1\":0,\"glasses_2\":1,\"hair_color_1\":5,\"glasses\":0,\"tshirt_2\":0,\"helmet_1\":11}','{\"tshirt_1\":35,\"torso_1\":48,\"arms\":14,\"pants_1\":34,\"pants_2\":0,\"decals_2\":1,\"hair_color_2\":0,\"shoes\":24,\"helmet_2\":0,\"hair_2\":3,\"decals_1\":7,\"torso_2\":0,\"face\":21,\"hair_1\":11,\"skin\":34,\"sex\":1,\"glasses_1\":5,\"glasses_2\":1,\"hair_color_1\":10,\"glasses\":0,\"tshirt_2\":0,\"helmet_1\":57}'),
('police',2,'lieutenant','Lieutenant',85,'{\"tshirt_1\":58,\"torso_1\":55,\"shoes\":24,\"pants_1\":35,\"pants_2\":0,\"decals_2\":2,\"hair_color_2\":0,\"face\":19,\"helmet_2\":0,\"hair_2\":0,\"glasses\":0,\"decals_1\":8,\"hair_color_1\":5,\"hair_1\":2,\"skin\":34,\"sex\":0,\"glasses_1\":0,\"glasses_2\":1,\"torso_2\":0,\"arms\":41,\"tshirt_2\":0,\"helmet_1\":11}','{\"tshirt_1\":35,\"torso_1\":48,\"arms\":44,\"pants_1\":34,\"hair_2\":3,\"decals_2\":2,\"hair_color_2\":0,\"hair_color_1\":10,\"helmet_2\":0,\"face\":21,\"shoes\":24,\"torso_2\":0,\"glasses_2\":1,\"hair_1\":11,\"skin\":34,\"sex\":1,\"glasses_1\":5,\"pants_2\":0,\"decals_1\":7,\"glasses\":0,\"tshirt_2\":0,\"helmet_1\":57}'),
('police',3,'boss','Commandant',100,'{\"tshirt_1\":58,\"torso_1\":55,\"shoes\":24,\"pants_1\":35,\"pants_2\":0,\"decals_2\":3,\"hair_color_2\":0,\"face\":19,\"helmet_2\":0,\"hair_2\":0,\"arms\":41,\"torso_2\":0,\"hair_color_1\":5,\"hair_1\":2,\"skin\":34,\"sex\":0,\"glasses_1\":0,\"glasses_2\":1,\"decals_1\":8,\"glasses\":0,\"tshirt_2\":0,\"helmet_1\":11}','{\"tshirt_1\":35,\"torso_1\":48,\"arms\":44,\"pants_1\":34,\"pants_2\":0,\"decals_2\":3,\"hair_color_2\":0,\"face\":21,\"helmet_2\":0,\"hair_2\":3,\"decals_1\":7,\"torso_2\":0,\"hair_color_1\":10,\"hair_1\":11,\"skin\":34,\"sex\":1,\"glasses_1\":5,\"glasses_2\":1,\"shoes\":24,\"glasses\":0,\"tshirt_2\":0,\"helmet_1\":57}')
;
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
INSERT INTO `fine_types` (label, amount, category) VALUES
('Usage abusif du klaxon',30,0),
('Franchir une ligne continue',40,0),
('Circulation à contresens',250,0),