2026-04-14 17:41:39 +02:00

61 lines
1.5 KiB
Lua

--- Desencrypted By PrejuicioX
function SaveOutfit()
Citizen.CreateThread(function()
SetNuiFocus(false, false)
local outfitName = TextInput(32)
if outfitName then
Debug("Outfit name: " .. outfitName)
local outfitData = GetCurrentOutfitData()
local playerModel = GetEntityModel(PlayerPedId())
local bagNetworkId = NetworkGetNetworkIdFromEntity(CURRENT_BAG)
local bagStateId = Entity(CURRENT_BAG).state.kq_ob_bag
TriggerServerEvent("kq_outfitbag2:server:saveOutfit", {
name = outfitName,
data = outfitData,
model = playerModel
}, bagNetworkId, bagStateId)
else
Debug("canceled")
end
SetNuiFocus(true, true)
end)
end
function DeleteOutfit(outfitId)
local bagNetworkId = NetworkGetNetworkIdFromEntity(CURRENT_BAG)
local bagStateId = Entity(CURRENT_BAG).state.kq_ob_bag
TriggerServerEvent("kq_outfitbag2:server:deleteOutfit", tonumber(outfitId), bagNetworkId, bagStateId)
end
function TogglePublicState(isPublic)
NetworkRequestControlOfEntity(CURRENT_BAG)
Entity(CURRENT_BAG).state:set("kq_ob_public", isPublic, true)
WipeCache("IsPublic" .. CURRENT_BAG)
Citizen.Wait(50)
UpdatePublicState()
end
AddStateBagChangeHandler("kq_ob_outfits", nil, function(bagName)
local bagEntity = GetEntityFromStateBagName(bagName)
if bagEntity ~= CURRENT_BAG then
return
end
Citizen.Wait(200)
RefreshNuiBagOutfits(bagEntity)
end)
--- Desencrypted By PrejuicioX