From 26bb94b8f4604e98c78d3b5360f39502b16aa893 Mon Sep 17 00:00:00 2001 From: TheiLLeniumStudios <104288623+TheiLLeniumStudios@users.noreply.github.com> Date: Mon, 20 Jun 2022 19:07:28 +0000 Subject: [PATCH] refactor(client): Move LoadPlayerUniform above --- client/client.lua | 52 +++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/client/client.lua b/client/client.lua index 4ec90dc..f7ac147 100644 --- a/client/client.lua +++ b/client/client.lua @@ -45,6 +45,32 @@ local function RemoveTargets() end end +local function LoadPlayerUniform() + QBCore.Functions.TriggerCallback("fivem-appearance:server:getUniform", function(uniformData) + if not uniformData then + return + end + local outfits = Config.Outfits[uniformData.jobName][uniformData.gender] + local uniform = nil + for i = 1, #outfits, 1 do + if outfits[i].outfitLabel == uniformData.label then + uniform = outfits[i] + break + end + end + + if not uniform then + TriggerServerEvent("fivem-appearance:server:syncUniform", nil) -- Uniform doesn't exist anymore + return + end + + uniform.jobName = uniformData.jobName + uniform.gender = uniformData.gender + + TriggerEvent("qb-clothing:client:loadOutfit", uniform) + end) +end + local function InitAppearance() PlayerData = QBCore.Functions.GetPlayerData() PlayerJob = PlayerData.job @@ -105,32 +131,6 @@ RegisterNetEvent('QBCore:Client:SetDuty', function(duty) PlayerJob.onduty = duty end) -local function LoadPlayerUniform() - QBCore.Functions.TriggerCallback("fivem-appearance:server:getUniform", function(uniformData) - if not uniformData then - return - end - local outfits = Config.Outfits[uniformData.jobName][uniformData.gender] - local uniform = nil - for i = 1, #outfits, 1 do - if outfits[i].outfitLabel == uniformData.label then - uniform = outfits[i] - break - end - end - - if not uniform then - TriggerServerEvent("fivem-appearance:server:syncUniform", nil) -- Uniform doesn't exist anymore - return - end - - uniform.jobName = uniformData.jobName - uniform.gender = uniformData.gender - - TriggerEvent("qb-clothing:client:loadOutfit", uniform) - end) -end - RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() InitAppearance() end)