From bf17559bfb9649989f605a6b0764f1995f1f40b8 Mon Sep 17 00:00:00 2001 From: Romain Lanz Date: Sat, 14 Oct 2017 14:20:41 +0200 Subject: [PATCH] feat(clothes): add proper clothes --- client/main.lua | 151 +++++++++++++++++++++++++++++++++++++++++++--- esx_policejob.sql | 21 ++++--- 2 files changed, 155 insertions(+), 17 deletions(-) diff --git a/client/main.lua b/client/main.lua index ebc28b8a..f7887a60 100644 --- a/client/main.lua +++ b/client/main.lua @@ -51,10 +51,32 @@ 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' } } + if PlayerData.job.grade_name == 'recruit' then + table.insert(elements, {label = _U('cadet_wear'), value = 'cadet_wear'}) + end + + 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 + + table.insert(elements, {label = _U('veste_wear'), value = 'veste_wear'}) + table.insert(elements, {label = _U('gilet_wear'), value = 'gilet_wear'}) + ESX.UI.Menu.CloseAll() if Config.EnableNonFreemodePeds then @@ -100,18 +122,133 @@ 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 == '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' then diff --git a/esx_policejob.sql b/esx_policejob.sql index f0eb8786..78fd3915 100644 --- a/esx_policejob.sql +++ b/esx_policejob.sql @@ -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),