darktrovx / devyn-backitems

FiveM Lua Script for displaying items on the players back.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

weapons disappear with reloadskin, or job clothing

SmithyDevelopment opened this issue · comments

when changing clothing, or using the illenium-appearance reloadskin command, everything falls off the characters back.
I tried adding the TriggerEvent("backitems:displayItems", true)
into the scripts to combat this but it didnt work.

Edit client.lua around line 856

RegisterNetEvent('fivem-appearance:client:reloadSkin', function()
if InCooldown() or CheckPlayerMeta() then
QBCore.Functions.Notify("You cannot use reloadskin right now", "error")
return
end

reloadSkinTimer = GetGameTimer()
local playerPed = PlayerPedId()
local health = GetEntityHealth(playerPed)
local maxhealth = GetEntityMaxHealth(playerPed)
local armour = GetPedArmour(playerPed)

QBCore.Functions.TriggerCallback('fivem-appearance:server:getAppearance', function(appearance)
    if not appearance then
        return
    end
    exports[resourceName]:setPlayerAppearance(appearance)
    if Config.PersistUniforms then
        TriggerServerEvent("fivem-appearance:server:syncUniform", nil)
    end
    playerPed = PlayerPedId()
    SetPedMaxHealth(playerPed, maxhealth)
    Wait(1000) -- Safety Delay
    SetEntityHealth(playerPed, health)
    SetPedArmour(playerPed, armour)
    ResetRechargeMultipliers()
    TriggerEvent("backitems:displayItems", false)
    TriggerEvent("backitems:displayItems", true)
end)

end)

I can confirm this fix works. Thank you for the great find!