Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions client/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ local function LoadPlayerUniform(reset)

TriggerEvent("illenium-appearance:client:changeOutfit", uniform)
else
local outfits = Config.Outfits[uniformData.jobName][uniformData.gender]
local jobOutfits = Config.Outfits[uniformData.jobName]
local outfits = jobOutfits and jobOutfits[uniformData.gender]
local uniform = nil
for i = 1, #outfits, 1 do
if outfits[i].name == uniformData.label then
uniform = outfits[i]
break
if outfits then
for i = 1, #outfits, 1 do
if outfits[i].name == uniformData.label then
uniform = outfits[i]
break
end
end
end

Expand Down Expand Up @@ -727,7 +730,7 @@ RegisterNetEvent("illenium-appearance:client:reloadSkin", function(bypassChecks)
end
client.setPlayerAppearance(appearance)
if Config.PersistUniforms then
LoadPlayerUniform(bypassChecks)
LoadPlayerUniform()
end
RestorePlayerStats()
end)
Expand Down
5 changes: 4 additions & 1 deletion client/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ function CheckDuty()
end

function IsPlayerAllowedForOutfitRoom(outfitRoom)
if not outfitRoom or not outfitRoom.citizenIDs or #outfitRoom.citizenIDs == 0 then
return true
end
local isAllowed = false
local count = #outfitRoom.citizenIDs
for i = 1, count, 1 do
Expand All @@ -11,7 +14,7 @@ function IsPlayerAllowedForOutfitRoom(outfitRoom)
break
end
end
return isAllowed or not outfitRoom.citizenIDs or count == 0
return isAllowed
end

function GetPlayerJobOutfits(job)
Expand Down
2 changes: 1 addition & 1 deletion client/outfits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ RegisterNetEvent("illenium-appearance:client:openOutfitMenu", function()
OpenMenu(nil, "outfit")
end)

RegisterNetEvent("illenium-apearance:client:outfitsCommand", function(isJob)
RegisterNetEvent("illenium-appearance:client:outfitsCommand", function(isJob)
local outfits = GetPlayerJobOutfits(isJob)
TriggerEvent("illenium-appearance:client:openJobOutfitsMenu", outfits)
end)
4 changes: 4 additions & 0 deletions client/zones.lua
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,16 @@ AddEventHandler("onResourceStop", function(resource)
end)

RegisterNetEvent("illenium-appearance:client:OpenClothingRoom", function()
if not currentZone or not currentZone.index then return end
local clothingRoom = Config.ClothingRooms[currentZone.index]
if not clothingRoom then return end
local outfits = GetPlayerJobOutfits(clothingRoom.job)
TriggerEvent("illenium-appearance:client:openJobOutfitsMenu", outfits)
end)

RegisterNetEvent("illenium-appearance:client:OpenPlayerOutfitRoom", function()
if not currentZone or not currentZone.index then return end
local outfitRoom = Config.PlayerOutfitRooms[currentZone.index]
if not outfitRoom then return end
OpenOutfitRoom(outfitRoom)
end)
15 changes: 13 additions & 2 deletions server/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ end)

lib.callback.register("illenium-appearance:server:importOutfitCode", function(source, outfitName, outfitCode)
local citizenID = Framework.GetPlayerID(source)
if not citizenID then return nil end

local existingOutfitCode = Database.PlayerOutfitCodes.GetByCode(outfitCode)
if not existingOutfitCode then
return nil
Expand All @@ -77,6 +79,10 @@ lib.callback.register("illenium-appearance:server:importOutfitCode", function(so
return
end

if outfitCache[citizenID] == nil then
getOutfitsForPlayer(citizenID)
end

outfitCache[citizenID][#outfitCache[citizenID] + 1] = {
id = id,
name = outfitName,
Expand Down Expand Up @@ -272,9 +278,14 @@ end)
RegisterNetEvent("illenium-appearance:server:deleteOutfit", function(id)
local src = source
local citizenID = Framework.GetPlayerID(src)
if not citizenID then return end
Database.PlayerOutfitCodes.DeleteByOutfitID(id)
Database.PlayerOutfits.DeleteByID(id)

if outfitCache[citizenID] == nil then
getOutfitsForPlayer(citizenID)
end

for k, v in ipairs(outfitCache[citizenID]) do
if v.id == id then
table.remove(outfitCache[citizenID], k)
Expand Down Expand Up @@ -335,11 +346,11 @@ end

if Config.EnableJobOutfitsCommand then
lib.addCommand("joboutfits", { help = _L("commands.joboutfits.title"), }, function(source)
TriggerClientEvent("illenium-apearance:client:outfitsCommand", source, true)
TriggerClientEvent("illenium-appearance:client:outfitsCommand", source, true)
end)

lib.addCommand("gangoutfits", { help = _L("commands.gangoutfits.title"), }, function(source)
TriggerClientEvent("illenium-apearance:client:outfitsCommand", source)
TriggerClientEvent("illenium-appearance:client:outfitsCommand", source)
end)
end

Expand Down