From 6933f6c02450b3d040a90c82908bcf051d2ba5cb Mon Sep 17 00:00:00 2001 From: iLLeniumStudios <104288623+TheiLLeniumStudios@users.noreply.github.com> Date: Tue, 20 Jun 2023 10:46:47 +0200 Subject: [PATCH] feat(server/commands): Command support for opening job / gang outfit menus (#326) * feat(server/commands): Command support for opening job / gang outfit menus * Remove unused args --------- Co-authored-by: TheiLLeniumStudios --- client/common.lua | 10 +++++----- client/outfits.lua | 5 +++++ client/target/target.lua | 2 +- client/zones.lua | 4 ++-- locales/ar.lua | 6 ++++++ locales/bg.lua | 6 ++++++ locales/de.lua | 6 ++++++ locales/en.lua | 6 ++++++ locales/es-ES.lua | 6 ++++++ locales/fr.lua | 6 ++++++ locales/hu.lua | 6 ++++++ locales/it.lua | 6 ++++++ locales/nl.lua | 6 ++++++ locales/pt-BR.lua | 6 ++++++ locales/ro-RO.lua | 6 ++++++ server/server.lua | 10 ++++++++++ shared/config.lua | 2 ++ 17 files changed, 91 insertions(+), 8 deletions(-) diff --git a/client/common.lua b/client/common.lua index e1c4aed..6a92608 100644 --- a/client/common.lua +++ b/client/common.lua @@ -14,14 +14,14 @@ function IsPlayerAllowedForOutfitRoom(outfitRoom) return isAllowed or not outfitRoom.citizenIDs or count == 0 end -function GetPlayerJobOutfits(clothingRoom) +function GetPlayerJobOutfits(job) local outfits = {} local gender = Framework.GetGender() - local gradeLevel = clothingRoom.job and Framework.GetJobGrade() or Framework.GetGangGrade() - local jobName = clothingRoom.job and client.job.name or client.gang.name + local gradeLevel = job and Framework.GetJobGrade() or Framework.GetGangGrade() + local jobName = job and client.job.name or client.gang.name if Config.BossManagedOutfits then - local mType = clothingRoom.job and "Job" or "Gang" + local mType = job and "Job" or "Gang" local result = lib.callback.await("illenium-appearance:server:getManagementOutfits", false, mType, gender) for i = 1, #result, 1 do outfits[#outfits + 1] = { @@ -33,7 +33,7 @@ function GetPlayerJobOutfits(clothingRoom) name = result[i].name } end - else + elseif Config.Outfits[jobName] and Config.Outfits[jobName][gender] then for i = 1, #Config.Outfits[jobName][gender], 1 do for _, v in pairs(Config.Outfits[jobName][gender][i].grades) do if v == gradeLevel then diff --git a/client/outfits.lua b/client/outfits.lua index d7fb660..b477a46 100644 --- a/client/outfits.lua +++ b/client/outfits.lua @@ -135,3 +135,8 @@ RegisterNetEvent("illenium-appearance:client:loadJobOutfit", LoadJobOutfit) RegisterNetEvent("illenium-appearance:client:openOutfitMenu", function() OpenMenu(nil, "outfit") end) + +RegisterNetEvent("illenium-apearance:client:outfitsCommand", function(isJob) + local outfits = GetPlayerJobOutfits(isJob) + TriggerEvent("illenium-appearance:client:openJobOutfitsMenu", outfits) +end) diff --git a/client/target/target.lua b/client/target/target.lua index df72e2e..0b6a44c 100644 --- a/client/target/target.lua +++ b/client/target/target.lua @@ -118,7 +118,7 @@ local function SetupClothingRoomTargets() for k, v in pairs(Config.ClothingRooms) do local targetConfig = Config.TargetConfig["clothingroom"] local action = function() - local outfits = GetPlayerJobOutfits(v) + local outfits = GetPlayerJobOutfits(v.job) TriggerEvent("illenium-appearance:client:openJobOutfitsMenu", outfits) end diff --git a/client/zones.lua b/client/zones.lua index d5e0892..fd0da1c 100644 --- a/client/zones.lua +++ b/client/zones.lua @@ -151,7 +151,7 @@ local function ZonesLoop() if IsControlJustReleased(0, 38) then if currentZone.name == "clothingRoom" then local clothingRoom = Config.ClothingRooms[currentZone.index] - local outfits = GetPlayerJobOutfits(clothingRoom) + local outfits = GetPlayerJobOutfits(clothingRoom.job) TriggerEvent("illenium-appearance:client:openJobOutfitsMenu", outfits) elseif currentZone.name == "playerOutfitRoom" then local outfitRoom = Config.PlayerOutfitRooms[currentZone.index] @@ -187,7 +187,7 @@ end) RegisterNetEvent("illenium-appearance:client:OpenClothingRoom", function() local clothingRoom = Config.ClothingRooms[currentZone.index] - local outfits = GetPlayerJobOutfits(clothingRoom) + local outfits = GetPlayerJobOutfits(clothingRoom.job) TriggerEvent("illenium-appearance:client:openJobOutfitsMenu", outfits) end) diff --git a/locales/ar.lua b/locales/ar.lua index d6e8469..5b05986 100644 --- a/locales/ar.lua +++ b/locales/ar.lua @@ -308,6 +308,12 @@ Locales["ar"] = { title = "خطأ", description = "لا يوجد اللاعب على الإنترنت" } + }, + joboutfits = { + title = "يفتح قائمة أزياء العمل" + }, + gangoutfits = { + title = "يفتح قائمة أزياء العصابات" } }, textUI = { diff --git a/locales/bg.lua b/locales/bg.lua index 926d945..be5199e 100644 --- a/locales/bg.lua +++ b/locales/bg.lua @@ -308,6 +308,12 @@ Locales["bg"] = { title = "Грешка", description = "Играчът не е на линия" } + }, + joboutfits = { + title = "Отваря менюто за екипировка за работа" + }, + gangoutfits = { + title = "Отваря менюто Gang Outfits" } }, textUI = { diff --git a/locales/de.lua b/locales/de.lua index e0d7798..d1f6f87 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -308,6 +308,12 @@ Locales["de"] = { title = "Fehler", description = "Spieler ist nicht online" } + }, + joboutfits = { + title = "Öffnet das Job-Outfits-Menü" + }, + gangoutfits = { + title = "Öffnet das Gang-Outfits-Menü" } }, textUI = { diff --git a/locales/en.lua b/locales/en.lua index ccf11a6..1bf45bd 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -308,6 +308,12 @@ Locales["en"] = { title = "Error", description = "Player not online" } + }, + joboutfits = { + title = "Opens Job Outfits Menu" + }, + gangoutfits = { + title = "Opens Gang Outfits Menu" } }, textUI = { diff --git a/locales/es-ES.lua b/locales/es-ES.lua index 8115bb7..d0ce802 100644 --- a/locales/es-ES.lua +++ b/locales/es-ES.lua @@ -308,6 +308,12 @@ Locales["es-ES"] = { title = "Error", description = "Jugador no en línea" } + }, + joboutfits = { + title = "Abre el menú de atuendos de trabajo" + }, + gangoutfits = { + title = "Abre el menú de atuendos de pandillas" } }, textUI = { diff --git a/locales/fr.lua b/locales/fr.lua index 134559d..c353a13 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -308,6 +308,12 @@ Locales["fr"] = { title = "Erreur", description = "Joueur non connecté" } + }, + joboutfits = { + title = "Ouvre le menu des tenues de travail" + }, + gangoutfits = { + title = "Ouvre le menu des tenues de gang" } }, textUI = { diff --git a/locales/hu.lua b/locales/hu.lua index 3f9362c..e44b774 100644 --- a/locales/hu.lua +++ b/locales/hu.lua @@ -308,6 +308,12 @@ Locales["hu"] = { title = "Hiba", description = "Játékos nincs fent" } + }, + joboutfits = { + title = "Megnyitja a Munkaruhák menüt" + }, + gangoutfits = { + title = "Megnyitja a Gang Outfits menüt" } }, textUI = { diff --git a/locales/it.lua b/locales/it.lua index 6f357a1..6463964 100644 --- a/locales/it.lua +++ b/locales/it.lua @@ -308,6 +308,12 @@ Locales["it"] = { title = "Errore", description = "Giocatore non connesso" } + }, + joboutfits = { + title = "Apre il menu degli abiti da lavoro" + }, + gangoutfits = { + title = "Apre il menu degli abiti da gang" } }, textUI = { diff --git a/locales/nl.lua b/locales/nl.lua index 3417450..827192e 100644 --- a/locales/nl.lua +++ b/locales/nl.lua @@ -308,6 +308,12 @@ Locales["nl"] = { title = "Fout", description = "Speler niet online" } + }, + joboutfits = { + title = "Opent het menu Joboutfits" + }, + gangoutfits = { + title = "Opent het menu Bende-outfits" } }, textUI = { diff --git a/locales/pt-BR.lua b/locales/pt-BR.lua index 591f7d7..19bbcd7 100644 --- a/locales/pt-BR.lua +++ b/locales/pt-BR.lua @@ -308,6 +308,12 @@ Locales["pt-BR"] = { title = "Erro", description = "Jogador não está online" } + }, + joboutfits = { + title = "Abre o Menu de Trajes de Trabalho" + }, + gangoutfits = { + title = "Abre o menu de trajes de gangue" } }, textUI = { diff --git a/locales/ro-RO.lua b/locales/ro-RO.lua index 031e490..6c68b9b 100644 --- a/locales/ro-RO.lua +++ b/locales/ro-RO.lua @@ -308,6 +308,12 @@ Locales["ro-RO"] = { title = "Eroare", description = "Jucătorul nu este conectat" } + }, + joboutfits = { + title = "Deschide meniul ținute pentru locuri de muncă" + }, + gangoutfits = { + title = "Deschide meniul Gang Outfits" } }, textUI = { diff --git a/server/server.lua b/server/server.lua index d7ceeca..024906b 100644 --- a/server/server.lua +++ b/server/server.lua @@ -333,6 +333,16 @@ if Config.EnablePedMenu then end) end +if Config.EnableJobOutfitsCommand then + lib.addCommand("joboutfits", { help = _L("commands.joboutfits.title"), }, function(source) + TriggerClientEvent("illenium-apearance:client:outfitsCommand", source, true) + end) + + lib.addCommand("gangoutfits", { help = _L("commands.gangoutfits.title"), }, function(source) + TriggerClientEvent("illenium-apearance:client:outfitsCommand", source) + end) +end + lib.addCommand("reloadskin", { help = _L("commands.reloadskin.title") }, function(source) TriggerClientEvent("illenium-appearance:client:reloadSkin", source) end) diff --git a/shared/config.lua b/shared/config.lua index 73020a3..b3dd23d 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -36,6 +36,8 @@ Config.EnablePedsForPlayerOutfitRooms = true Config.EnablePedMenu = true Config.PedMenuGroup = "group.admin" +Config.EnableJobOutfitsCommand = false -- Enables /joboutfits and /gangoutfits commands + Config.ShowNearestShopOnly = false Config.HideRadar = false -- Hides the minimap while the appearance menu is open Config.NearestShopBlipUpdateDelay = 10000