SCode Software
Tebex StoreSiberWin StudiosCFX.REDiscord
  • Welcome to SCode!
  • General Information
  • Common Questions
  • SCRIPTS
  • ⭐SCode Home
    • 1️⃣Installation
    • 2️⃣SQL - Database Installation
    • ⚙️Configuration
  • ⭐SCode Caravan
    • 💻Installation
    • ⚙️Configuration
  • ⭐SCode Police Callsign
    • 💻Installation
    • ⚙️Configuration
  • ⭐SCode Drawtext UI
    • 💻Installation
    • ⚙️Configuration
    • 💻Usage Examples
    • 💻Practical Examples
  • ⭐SCode Freecam
    • 💻Installation
    • ⚙️Configuration
  • MAP - MLO
    • 🧩Lake Houses
    • 🧩Mirror Park GangHouse
    • 🧩South Side HOOD
Powered by GitBook
On this page
  • Required Resources
  • Supported Inventories
  • OLD - QB-INVENTORY Installation
  • House Keys Image
  • QB-PHONE Installation
  • STEP - 1 LATEST - QB-INVENTORY Installation
  1. SCode Home

Installation

PreviousSCode HomeNextSQL - Database Installation

Last updated 3 months ago

Required Resources

Resource
Download's

qb-target

scode-uidrawtext

PolyZone

InteractSound

Supported Inventories

  • qb-inventory (old)

  • qb-inventory (latest)

  • ox-inventory (coming soon)


OLD - QB-INVENTORY Installation

What needs to be done for stash and meta key system!

Find the function FormatItemInfo(itemData) in your qb-inventory/html/js/app.js file path.

Find the line of code indicated in red in the photo above and add the following code block to the appropriate place.

 } else if (itemData.name == "housekeys") {
            $(".item-info-title").html('<p>' + itemData.label + '</p>');
            $(".item-info-description").html('<p><strong></strong><span>House No: ' + itemData.info.HouseId + '</span></p>');

House Keys Image

For the Housekeys photo, drag and drop the housekeys.png file into the qb-inventory/html/images folder.

You can find the Housekeys photo by accessing the scode-home-v1/setup file path.


QB-PHONE Installation

To receive notifications via QB-Phone, open the qb-phone/fxmanifest.lua file path and add the following code block.

server_scripts {
    '@oxmysql/lib/MySQL.lua',
    'server/main.lua',
    '@scode-home-v1/shared.lua'
}

QB-CORE Installation

Find and open the qb-core/shared/items.lua file path in your server file. Then add the following code as item.

 ['housekeys'] 	 = {['name'] = 'housekeys',['label'] = 'House Key', ['weight'] = 200, ['type'] = 'item', ['image'] = 'housekeys.png', ['unique'] = true, ['useable'] = true, 	['shouldClose'] = true,   ['combinable'] = nil,   ['description'] = 'Lake House Key'},

STEP - 1 LATEST - QB-INVENTORY Installation

Find the AddItem function and update it as follows: (qb-inventory/server/functions.lua)

Find the relevant code block in step 1, replace it with the code line given below in step 2.

  inventory[slot] = {
        name = item,
        amount = amount,
        info = info or {},
        label = itemInfo.label,
        description = itemInfo.description or '',
        weight = itemInfo.weight,
        type = itemInfo.type,
        unique = itemInfo.unique,
        useable = item == "housekeys" and true or itemInfo.useable, -- Add Line
        image = itemInfo.image,
        shouldClose = itemInfo.shouldClose,
        slot = slot,
        combinable = itemInfo.combinable
    }

STEP 2 - Find the AddItem function and update it as follows:

(qb-inventory/server/functions.lua)

Find the : exports('SetItemData', SetItemData) function.

STEP 3 - Find the relevant code block in step 1, replace it with the code line given below in step 2.

exports('SetItemData', SetItemData)


local function AddHouseKeyInfo(item, info)
    if item == "housekeys" then
        if not info then info = {} end
        info.HouseId = info.HouseId or "Unknown"  
        info.KeyData = info.KeyData or "default_key"  
        info.useable = true 
    end
    return info
end

function UseItem(itemName, ...)
    local itemData = QBCore.Functions.CanUseItem(itemName)
    
   
    if itemName == "housekeys" then
        local args = {...}
        local src = args[1]  
        local itemData = args[2]  
        
      
        if src and itemData and itemData.info and itemData.info.HouseId then
           
            TriggerClientEvent('Scode:Hom:Client:UseHouseKeys', src, 
                itemData.info.HouseId,  
                itemData.info.KeyData   
            )
            return
        end
    end
    
   
    if type(itemData) == "table" and itemData.func then
        itemData.func(...)
    end
end

exports('UseItem', UseItem)

STEP 4 - Find the AddItem function and update it as follows: (qb-inventory/server/main.lua)

You can add the following code block anywhere in qb-inventory/server/main.lua.

RegisterNetEvent('qb-inventory:server:OpenInventory', function(inventoryType, id, other)
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)
    if not Player then return end

    if inventoryType == "stash" then
        local houseId = tonumber(string.match(id, "HouseStash_(%d+)"))
        local stashId = tonumber(string.match(id, "HouseStash_%d+_(%d+)"))
        
        QBCore.Functions.TriggerCallback('Scode:Hom:Server:CheckStashAccess', source, function(hasAccess)
            if hasAccess then
                local stashData = {
                    name = id,
                    label = other.label or ("House " .. houseId .. " - Stash " .. stashId),
                    maxweight = other.maxweight,
                    slots = other.slots,
                    inventory = {}
                }

                if not Inventories[id] then
                    Inventories[id] = {
                        label = stashData.label,
                        slots = stashData.slots,
                        maxweight = stashData.maxweight,
                        inventory = {},
                        isOpen = false,
                        items = {}
                    }
                end

                local playerItems = Player.PlayerData.items
                TriggerClientEvent('qb-inventory:client:openInventory', src, playerItems, {
                    name = id,
                    label = stashData.label,
                    maxweight = stashData.maxweight,
                    slots = stashData.slots,
                    inventory = Inventories[id].items
                })
            else
                TriggerClientEvent('QBCore:Notify', src, 'Bu stasha erişiminiz yok!', 'error')
            end
        end, houseId, stashId)
    end
end)


QBCore.Functions.CreateUseableItem("housekeys", function(source, item)
    local Player = QBCore.Functions.GetPlayer(source)
    if not Player then return end
    
    if item.info and item.info.HouseId then
        TriggerClientEvent('Scode:Hom:Client:UseHouseKeys', source, {
            HouseId = item.info.HouseId,
            KeyData = item.info.KeyData
        })
    else
        TriggerClientEvent('QBCore:Notify', source, 'Bu anahtar hasarlı görünüyor!', 'error')
    end
end)


RegisterNetEvent('qb-inventory:server:GiveItem', function(target, item, amount)
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)
    
    if item.name == "housekeys" then
        local keyInfo = {
            HouseId = item.info.HouseId,
            KeyData = item.info.KeyData,
            label = item.info.label
        }
        
        if AddItem(target, "housekeys", 1, nil, keyInfo) then
            RemoveItem(src, "housekeys", 1, item.slot)
        end
    end
end)

Download
Download
Download
Download
⭐
1️⃣
housekeys.png
It should look like this after your changes.
Page cover image