Skip to content

Commit

Permalink
feat(server/commands): Command support for opening job / gang outfit …
Browse files Browse the repository at this point in the history
…menus (#326)

* feat(server/commands): Command support for opening job / gang outfit menus

* Remove unused args

---------

Co-authored-by: TheiLLeniumStudios <theilleniumstudios@gmail.com>
  • Loading branch information
TheiLLeniumStudios and TheiLLeniumStudios authored Jun 20, 2023
1 parent 4563165 commit 6933f6c
Show file tree
Hide file tree
Showing 17 changed files with 91 additions and 8 deletions.
10 changes: 5 additions & 5 deletions client/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions client/outfits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion client/target/target.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions client/zones.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)

Expand Down
6 changes: 6 additions & 0 deletions locales/ar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,12 @@ Locales["ar"] = {
title = "خطأ",
description = "لا يوجد اللاعب على الإنترنت"
}
},
joboutfits = {
title = "يفتح قائمة أزياء العمل"
},
gangoutfits = {
title = "يفتح قائمة أزياء العصابات"
}
},
textUI = {
Expand Down
6 changes: 6 additions & 0 deletions locales/bg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,12 @@ Locales["bg"] = {
title = "Грешка",
description = "Играчът не е на линия"
}
},
joboutfits = {
title = "Отваря менюто за екипировка за работа"
},
gangoutfits = {
title = "Отваря менюто Gang Outfits"
}
},
textUI = {
Expand Down
6 changes: 6 additions & 0 deletions locales/de.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 6 additions & 0 deletions locales/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 6 additions & 0 deletions locales/es-ES.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 6 additions & 0 deletions locales/fr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 6 additions & 0 deletions locales/hu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 6 additions & 0 deletions locales/it.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 6 additions & 0 deletions locales/nl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 6 additions & 0 deletions locales/pt-BR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 6 additions & 0 deletions locales/ro-RO.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
10 changes: 10 additions & 0 deletions server/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions shared/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6933f6c

Please sign in to comment.