MenanAk47
  • Welcome
  • FAQ
  • ESX
    • ak47_whitewidowv2
      • Installation
      • Configuration
    • ak47_cannabiscafev2
      • Installation
      • Configuration
    • ak47_clothing
      • Installation
      • Configuration
      • Integration
      • Exports
      • Triggers
      • Commands
      • Common Issues
    • ak47_iclothingv3
      • Installation
    • ak47_switch
      • Installation
      • Commands
    • ak47_crutch
      • Installation
      • Triggers
      • Commands
    • ak47_housing
      • Installation
      • Configuration
      • Integration
      • Commands
      • Common Issues
    • ak47_cardealer
      • Installation
      • Configuration
      • Integration
      • Commands
      • Common Issues
    • ak47_ambulancejob
      • Installation
      • Guideline
      • Items
      • Integration
      • Commands
      • Triggers
      • Exports
    • ak47_gangs
      • Installation
      • Integration
      • Commands
      • Exports
    • ak47_garage
      • Installation
      • Integration
      • Commands
    • ak47_jobgarage
      • Installation
      • Integration
      • Commands
    • ak47_vehiclekeys
      • Installation
      • Integration
      • Commands
    • ak47_carboosting
      • Installation
      • Integration
      • Commands
    • ak47_safezone
      • Installation
      • Integration
      • Commands
    • ak47_inventory
      • Installation
      • Exports
        • Client
        • Server
      • Event Handlers
        • Client
        • Server
      • Commands
      • Guides
        • Custom Stash
        • External Shop
        • Protected Item
        • Convert Items
        • Show Info Value
      • Templates
        • Item
        • Weapon
        • Crafting
        • Stash
        • Shop
        • Vending
        • Dumpster
        • Tooltip
      • Modified Scripts
        • LegacyFuel
    • ak47_idcardv2
      • Installation
      • Integration
      • Commands
    • ak47_territories
      • Installation
      • Integration
      • Commands
      • Exports
  • QBCore
    • ak47_qb_whitewidowv2
      • Installation
      • Configuration
    • ak47_qb_cannabiscafev2
      • Installation
      • Configuration
    • ak47_qb_clothing
      • Installation
      • Configuration
      • Integration
      • Exports
      • Triggers
      • Commands
      • Common Issues
    • ak47_qb_iclothingv3
      • Installation
    • ak47_qb_switch
      • Installation
      • Commands
    • ak47_qb_crutch
      • Installation
      • Triggers
      • Commands
    • ak47_qb_wanted
      • Installation
      • Triggers
    • ak47_qb_housing
      • Installation
      • Configuration
      • Integration
      • Commands
      • Common Issues
    • ak47_qb_cardealer
      • Installation
      • Configuration
      • Integration
      • Commands
      • Common Issues
    • ak47_qb_ambulancejob
      • Installation
      • Guideline
      • Items
      • Integration
      • Commands
      • Triggers
      • Exports
    • ak47_qb_gangs
      • Installation
      • Integration
      • Commands
      • Exports
    • ak47_qb_garage
      • Installation
      • Integration
      • Commands
    • ak47_qb_jobgarage
      • Installation
      • Integration
      • Commands
    • ak47_qb_vehiclekeys
      • Installation
      • Integration
      • Commands
    • ak47_qb_carboosting
      • Installation
      • Integration
      • Commands
    • ak47_qb_safezone
      • Installation
      • Integration
      • Commands
    • ak47_qb_inventory
      • Installation
      • Exports
        • Client
        • Server
      • Event Handlers
        • Client
        • Server
      • Commands
      • Guides
        • Custom Stash
        • External Shop
        • Protected Item
        • Convert Items
        • Enable Weapon Wheel
        • Show Info Value
      • Templates
        • Item
        • Weapon
        • Crafting
        • Stash
        • Shop
        • Vending
        • Dumpster
        • Tooltip
      • Modified Scripts
        • LegacyFuel
    • ak47_qb_idcardv2
      • Installation
      • Integration
      • Commands
    • ak47_qb_territories
      • Installation
      • Integration
      • Commands
      • Exports
Powered by GitBook
On this page
  • Add the script:
  • Modifications:
  1. QBCore
  2. ak47_qb_iclothingv3

Installation

Add the script:

  • Download ak47_qb_iclothingv3 from your keymaster.

  • Add the script into your resources folder.

  • Add items in qb-core/shared/items.lua.

  • Add item images into your inventory.

  • Start the script in server.cfg

  • Restart your server.

Modifications:

Inventory:

-- Action: Replace
-- Path: qb-inventory/server/main.lua

local function RemoveItem(source, item, amount, slot)
	local Player = QBCore.Functions.GetPlayer(source)
	if not Player then return false end
	amount = tonumber(amount) or 1
	slot = tonumber(slot)
	if slot then
		if Player.PlayerData.items[slot].amount > amount then
			Player.PlayerData.items[slot].amount = Player.PlayerData.items[slot].amount - amount
			Player.Functions.SetPlayerData("items", Player.PlayerData.items)
			if not Player.Offline then
				TriggerEvent('qb-log:server:CreateLog', 'playerinventory', 'RemoveItem', 'red', '**' .. GetPlayerName(source) .. ' (citizenid: ' .. Player.PlayerData.citizenid .. ' | id: ' .. source .. ')** lost item: [slot:' .. slot .. '], itemname: ' .. Player.PlayerData.items[slot].name .. ', removed amount: ' .. amount .. ', new total amount: ' .. Player.PlayerData.items[slot].amount)
			end
            TriggerEvent('qb-core:onRemoveInventoryItem', source, item)
			return true
		elseif Player.PlayerData.items[slot].amount == amount then
			Player.PlayerData.items[slot] = nil
			Player.Functions.SetPlayerData("items", Player.PlayerData.items)
			if Player.Offline then return true end
			TriggerEvent('qb-log:server:CreateLog', 'playerinventory', 'RemoveItem', 'red', '**' .. GetPlayerName(source) .. ' (citizenid: ' .. Player.PlayerData.citizenid .. ' | id: ' .. source .. ')** lost item: [slot:' .. slot .. '], itemname: ' .. item .. ', removed amount: ' .. amount .. ', item removed')
            TriggerEvent('qb-core:onRemoveInventoryItem', source, item)
			return true
		end
	else
		local slots = GetSlotsByItem(Player.PlayerData.items, item)
		local amountToRemove = amount
		if not slots then return false end
		for _, _slot in pairs(slots) do
			if Player.PlayerData.items[_slot].amount > amountToRemove then
				Player.PlayerData.items[_slot].amount = Player.PlayerData.items[_slot].amount - amountToRemove
				Player.Functions.SetPlayerData("items", Player.PlayerData.items)
				if not Player.Offline then
					TriggerEvent('qb-log:server:CreateLog', 'playerinventory', 'RemoveItem', 'red', '**' .. GetPlayerName(source) .. ' (citizenid: ' .. Player.PlayerData.citizenid .. ' | id: ' .. source .. ')** lost item: [slot:' .. _slot .. '], itemname: ' .. Player.PlayerData.items[_slot].name .. ', removed amount: ' .. amount .. ', new total amount: ' .. Player.PlayerData.items[_slot].amount)
				end
                TriggerEvent('qb-core:onRemoveInventoryItem', source, item)
				return true
			elseif Player.PlayerData.items[_slot].amount == amountToRemove then
				Player.PlayerData.items[_slot] = nil
				Player.Functions.SetPlayerData("items", Player.PlayerData.items)
				if Player.Offline then return true end
				TriggerEvent('qb-log:server:CreateLog', 'playerinventory', 'RemoveItem', 'red', '**' .. GetPlayerName(source) .. ' (citizenid: ' .. Player.PlayerData.citizenid .. ' | id: ' .. source .. ')** lost item: [slot:' .. _slot .. '], itemname: ' .. item .. ', removed amount: ' .. amount .. ', item removed')
                TriggerEvent('qb-core:onRemoveInventoryItem', source, item)
				return true
			end
		end
	end
	return false
end
-- Action: Replace
-- Path: qb-inventory/server/main.lua

function RemoveItem(identifier, item, amount, slot, reason)
    if not QBCore.Shared.Items[item:lower()] then
        print('RemoveItem: Invalid item')
        return false
    end
    local inventory
    local player = QBCore.Functions.GetPlayer(identifier)

    if player then
        inventory = player.PlayerData.items
    elseif Inventories[identifier] then
        inventory = Inventories[identifier].items
    elseif Drops[identifier] then
        inventory = Drops[identifier].items
    end

    if not inventory then
        print('RemoveItem: Inventory not found')
        return false
    end

    slot = tonumber(slot) or GetFirstSlotByItem(inventory, item)

    if not slot then
        print('RemoveItem: Slot not found')
        return false
    end

    local inventoryItem = inventory[slot]
    if not inventoryItem or inventoryItem.name:lower() ~= item:lower() then
        print('RemoveItem: Item not found in slot')
        return false
    end

    amount = tonumber(amount)
    if inventoryItem.amount < amount then
        print('RemoveItem: Not enough items in slot')
        return false
    end

    inventoryItem.amount = inventoryItem.amount - amount
    if inventoryItem.amount <= 0 then
        inventory[slot] = nil
    end

    if player then player.Functions.SetPlayerData('items', inventory) end
    local invName = player and GetPlayerName(identifier) .. ' (' .. identifier .. ')' or identifier
    local removeReason = reason or 'No reason specified'
    local resourceName = GetInvokingResource() or 'qb-inventory'
    TriggerEvent(
        'qb-log:server:CreateLog',
        'playerinventory',
        'Item Removed',
        'red',
        '**Inventory:** ' .. invName .. ' (Slot: ' .. slot .. ')\n' ..
        '**Item:** ' .. item .. '\n' ..
        '**Amount:** ' .. amount .. '\n' ..
        '**Reason:** ' .. removeReason .. '\n' ..
        '**Resource:** ' .. resourceName
    )

    if player then
        TriggerEvent('qb-core:onRemoveInventoryItem', player.PlayerData.source, item)
    end
    return true
end

No modification required.

-- Trigger this event from server side when item removes from your inventory
TriggerEvent('qb-core:onRemoveInventoryItem', source, itemName)

Clothing Menu:

-- Action: Add at the bottom
-- Path  : qb-clothing/client/main.lua 

RegisterNetEvent('qb-clothing:client:loadOutfit2')
AddEventHandler('qb-clothing:client:loadOutfit2', function(oData)
    local ped = PlayerPedId()

    data = oData.outfitData

    if typeof(data) ~= "table" then data = json.decode(data) end

    for k, v in pairs(data) do
        skinData[k].item = data[k].item
        skinData[k].texture = data[k].texture

        -- To secure backwards compability for facemixing
        if data[k].shapeMix then
            skinData[k].shapeMix = data[k].shapeMix
        end

        if data[k].skinMix then
            skinData[k].skinMix = data[k].skinMix
        end
    end

    -- Pants
    if data["pants"] ~= nil then
        SetPedComponentVariation(ped, 4, data["pants"].item, data["pants"].texture, 0)
    end

    -- Arms
    if data["arms"] ~= nil then
        SetPedComponentVariation(ped, 3, data["arms"].item, data["arms"].texture, 0)
    end

    -- T-Shirt
    if data["t-shirt"] ~= nil then
        SetPedComponentVariation(ped, 8, data["t-shirt"].item, data["t-shirt"].texture, 0)
    end

    -- Vest
    if data["vest"] ~= nil then
        SetPedComponentVariation(ped, 9, data["vest"].item, data["vest"].texture, 0)
    end

    -- Torso 2
    if data["torso2"] ~= nil then
        SetPedComponentVariation(ped, 11, data["torso2"].item, data["torso2"].texture, 0)
    end

    -- Shoes
    if data["shoes"] ~= nil then
        SetPedComponentVariation(ped, 6, data["shoes"].item, data["shoes"].texture, 0)
    end

    -- Bag
    if data["bag"] ~= nil then
        SetPedComponentVariation(ped, 5, data["bag"].item, data["bag"].texture, 0)
    end

    -- Badge
    if data["decals"] ~= nil then
        SetPedComponentVariation(ped, 10, data["decals"].item, data["decals"].texture, 0)
    end

    -- Accessory
    if data["accessory"] ~= nil then
        if QBCore.Functions.GetPlayerData().metadata["tracker"] then
            SetPedComponentVariation(ped, 7, 13, 0, 0)
        else
            SetPedComponentVariation(ped, 7, data["accessory"].item, data["accessory"].texture, 0)
        end
    end

    -- Mask
    if data["mask"] ~= nil then
        SetPedComponentVariation(ped, 1, data["mask"].item, data["mask"].texture, 0)
    end

    -- Bag
    if data["bag"] ~= nil then
        SetPedComponentVariation(ped, 5, data["bag"].item, data["bag"].texture, 0)
    end

    -- Hat
    if data["hat"] ~= nil then
        if data["hat"].item ~= -1 and data["hat"].item ~= 0 then
            SetPedPropIndex(ped, 0, data["hat"].item, data["hat"].texture, true)
        else
            ClearPedProp(ped, 0)
        end
    end

    -- Glass
    if data["glass"] ~= nil then
        if data["glass"].item ~= -1 and data["glass"].item ~= 0 then
            SetPedPropIndex(ped, 1, data["glass"].item, data["glass"].texture, true)
        else
            ClearPedProp(ped, 1)
        end
    end

    -- Ear
    if data["ear"] ~= nil then
        if data["ear"].item ~= -1 and data["ear"].item ~= 0 then
            SetPedPropIndex(ped, 2, data["ear"].item, data["ear"].texture, true)
        else
            ClearPedProp(ped, 2)
        end
    end

    -- watch
    if data["watch"] ~= nil then
        if data["watch"].item ~= -1 and data["watch"].item ~= 0 then
            SetPedPropIndex(ped, 6, data["watch"].item, data["watch"].texture, true)
        else
            ClearPedProp(ped, 6)
        end
    end

    if oData.outfitName ~= nil then
        QBCore.Functions.Notify("You have chosen "..oData.outfitName.."! Press Confirm to confirm outfit.")
    end
end)

AddEventHandler('qb-clothing:getSkin', function(cb)
    cb(skinData)
end)
-- Action: Add at the bottom
-- Path  : illenium-appearance/client/outfits.lua 

RegisterNetEvent('qb-clothing:client:loadOutfit2', function(oData)
    local ped = cache.ped

    local data = oData.outfitData

    if typeof(data) ~= "table" then
        data = json.decode(data)
    end

    -- Pants
    if data["pants"] ~= nil then
        SetPedComponentVariation(ped, 4, data["pants"].item, data["pants"].texture, 0)
    end

    -- Arms
    if data["arms"] ~= nil then
        SetPedComponentVariation(ped, 3, data["arms"].item, data["arms"].texture, 0)
    end

    -- T-Shirt
    if data["t-shirt"] ~= nil then
        SetPedComponentVariation(ped, 8, data["t-shirt"].item, data["t-shirt"].texture, 0)
    end

    -- Vest
    if data["vest"] ~= nil then
        SetPedComponentVariation(ped, 9, data["vest"].item, data["vest"].texture, 0)
    end

    -- Torso 2
    if data["torso2"] ~= nil then
        SetPedComponentVariation(ped, 11, data["torso2"].item, data["torso2"].texture, 0)
    end

    -- Shoes
    if data["shoes"] ~= nil then
        SetPedComponentVariation(ped, 6, data["shoes"].item, data["shoes"].texture, 0)
    end

    -- Badge
    if data["decals"] ~= nil then
        SetPedComponentVariation(ped, 10, data["decals"].item, data["decals"].texture, 0)
    end

    -- Accessory
    local tracker = Config.TrackerClothingOptions

    if data["accessory"] ~= nil then
        if Framework.HasTracker() then
            SetPedComponentVariation(ped, 7, tracker.drawable, tracker.texture, 0)
        else
            SetPedComponentVariation(ped, 7, data["accessory"].item, data["accessory"].texture, 0)
        end
    else
        if Framework.HasTracker() then
            SetPedComponentVariation(ped, 7, tracker.drawable, tracker.texture, 0)
        else
            local drawableId = GetPedDrawableVariation(ped, 7)
            
            if drawableId ~= -1 then
                local textureId = GetPedTextureVariation(ped, 7)
                if drawableId == tracker.drawable and textureId == tracker.texture then
                    SetPedComponentVariation(ped, 7, -1, 0, 2)
                end
            end
        end
    end

    -- Mask
    if data["mask"] ~= nil then
        SetPedComponentVariation(ped, 1, data["mask"].item, data["mask"].texture, 0)
    end

    -- Bag
    if data["bag"] ~= nil then
        SetPedComponentVariation(ped, 5, data["bag"].item, data["bag"].texture, 0)
    end

    -- Hat
    if data["hat"] ~= nil then
        if data["hat"].item ~= -1 then
            SetPedPropIndex(ped, 0, data["hat"].item, data["hat"].texture, true)
        else
            ClearPedProp(ped, 0)
        end
    end

    -- Glass
    if data["glass"] ~= nil then
        if data["glass"].item ~= -1 then
            SetPedPropIndex(ped, 1, data["glass"].item, data["glass"].texture, true)
        else
            ClearPedProp(ped, 1)
        end
    end

    -- Ear
    if data["ear"] ~= nil then
        if data["ear"].item ~= -1 then
            SetPedPropIndex(ped, 2, data["ear"].item, data["ear"].texture, true)
        else
            ClearPedProp(ped, 2)
        end
    end

    -- Watch
    if data["watch"] ~= nil then
        if data["watch"].item ~= -1 then
            SetPedPropIndex(ped, 6, data["watch"].item, data["watch"].texture, true)
        else
            ClearPedProp(ped, 6)
        end
    end

    -- Bracelet
    if data["bracelet"] ~= nil then
        if data["bracelet"].item ~= -1 then
            SetPedPropIndex(ped, 7, data["bracelet"].item, data["bracelet"].texture, true)
        else
            ClearPedProp(ped, 7)
        end
    end
end)

No modification required.

Notes:

  • Don't upload the script with FileZilla, Use Winscp if you are using FTP for file uploading.

  • Renaming of the script is not allowed.

  • We do not support custom frameworks, highly modified versions of QBCore, or deprecated/outdated versions of anything.

Previousak47_qb_iclothingv3Nextak47_qb_switch

Last updated 3 months ago