Documentazione

KAIRO OutfitBag

Hook e personalizzazione

Il core è protetto dall’escrow Cfx, ma questi file restano aperti e modificabili:

  • config.lua e locales/
  • editable/client.lua ed editable/server.lua: gli hook qui sotto
  • bridge/: integrazioni con framework, inventari, sistemi vestiti e target
  • install/
Ogni hook è facoltativo. Se ritorna nil o false resta il comportamento integrato; ritorna true quando te ne occupi tu.

Hook client

FunzioneQuando
Custom.Notify(message, kind)Notifiche (success, error, inform).
Custom.ShowTextUI(text) / HideTextUI()Text UI personalizzata.
Custom.SaveSkin(ped, part)Salvare la skin con un sistema vestiti non supportato.
Custom.CanOpen() / CanPlace()Controlli extra: ammanettato, morto, in una zona…
Custom.OnMenuOpen() / OnMenuClose()Nascondere l’HUD, disattivare il telefono…
Custom.OnOutfitApplied(name, section)Dopo che un outfit (o una parte) è stato indossato.
editable/client.lua
function Custom.Notify(message, kind)
    exports['my-notify']:Send(message, kind)
    return true
end

function Custom.CanOpen()
    if LocalPlayer.state.isCuffed then return false end
    return true
end

function Custom.OnMenuOpen()  TriggerEvent('my-hud:toggle', false) end
function Custom.OnMenuClose() TriggerEvent('my-hud:toggle', true)  end

Hook server

FunzioneQuando
Custom.GetIdentifier(source)Identificatore del personaggio per framework custom o multichar.
Custom.AddItem / RemoveItem(source, item, count)Inventari custom (ritorna true/false, nil = integrato).
Custom.RegisterUsable(item, onUse)Registrare tu l’item usabile.
Custom.Notify(source, message, kind)Notifiche dal server.
Custom.CanPlace(source) / CanOpen(source, bagOwner)Permessi: lavori, gang, VIP, zone… (false = blocca).
Custom.OnBagPlaced, OnBagPicked, OnOutfitSaved, OnOutfitDeletedLog e webhook.
editable/server.lua
function Custom.GetIdentifier(source)
    return exports['my-core']:GetCharId(source)
end

function Custom.RegisterUsable(item, onUse)
    exports['my-inventory']:RegisterUsable(item, function(source) onUse(source) end)
    return true
end

Guardaroba custom

Con Config.Wardrobe = 'custom' il borsone legge e scrive gli outfit con le tue funzioni in editable/server.lua.

editable/server.lua
-- outfit: { id = 'string', name = 'string', model = joaat or nil,
--           components = { [componentId] = { drawable, texture } },
--           props      = { [propId] = { drawable, texture } } }   -- drawable -1 = no prop
Custom.Wardrobe = {
    get = function(identifier)
        return {}               -- elenco degli outfit
    end,
    save = function(identifier, name, outfit, model)
        return true
    end,
    delete = function(identifier, id)
        return true
    end,
}