Installation Guide

This guide will provide step-by-step instructions on how to install and set up the KQ_PLACEABLE_ITEMS script for FiveM.

Step 1:

After downloading the script, unzip the folder and place it in the resources directory on your FiveM server.

Step 2:

Open the config.lua file in the script folder and make sure that the correct framework is enabled.

When using ox-inventory, set Config.oxInventorySettings > enabled to true and disable other frameworks

If you're not using ox-inventory, make sure to disable Config.oxInventorySettings > enabled

Step 3:

<!> Only needed when using persistent items

Next, you need to import the kq_placeable_items.sql file into your database. This will create the tables required for the script to function properly. You can watch this video for instructions on how to import an SQL file into your database: https://www.youtube.com/watch?v=xBbqDLXrZGY.

Step 4:

After the config file has been set up, add the script to your server.cfg file. Make sure that it's added after your framework of choice, so that it loads and starts properly.

Step 5:

Configure the script to your likings. Add your own items and define the corresponding models.

Done

Enjoy the script


OX-Inventory integration

Now if you wish to add a "Place" option to the inventory itself, simply add the following to each item within your ox-inventory items (and weapons) lists

buttons = {{ label = 'Place', action = function(slot) exports['kq_placeable_items']:placeItem(slot) end }},

Here's a full example:

    ["gold"] = {
        label = "Gold",
        weight = 1,
        stack = true,
        close = true,
        buttons = {{ label = 'Place', action = function(slot) exports['kq_placeable_items']:placeItem(slot) end }},
    },

This could also be automated. This will requrie a little modification to the items.lua file

At the top of the file, replace the instant return of the items table with:

local items = {

Then at the very bottom of the file add the following code

for k, item in pairs(items) do
    if not item.buttons then
        item.buttons = {{ label = 'Place', action = function(slot) exports['kq_placeable_items']:placeItem(slot) end }}
    else
        table.insert(item.buttons, { label = 'Place', action = function(slot) exports['kq_placeable_items']:placeItem(slot) end })
    end
end

return items

The resulting file should look something like this:

local items = {

    ['bandage'] = {
        label = 'Bandage',
        weight = 115,
        client = {
            anim = { dict = 'missheistdockssetup1clipboard@idle_a', clip = 'idle_a', flag = 49 },
            prop = { model = `prop_rolled_sock_02`, pos = vec3(-0.14, -0.14, -0.08), rot = vec3(-50.0, -50.0, 0.0) },
            disable = { move = true, car = true, combat = true },
            usetime = 2500,
        }
    },

    ['black_money'] = {
        label = 'Dirty Money',
    },

    ['burger'] = {
        label = 'Burger',
        weight = 220,
        client = {
            status = { hunger = 200000 },
            anim = 'eating',
            prop = 'burger',
            usetime = 2500,
            notification = 'You ate a delicious burger'
        },
    },
}

for k, item in pairs(items) do
    if not item.buttons then
        item.buttons = {{ label = 'Place', action = function(slot) exports['kq_placeable_items']:placeItem(slot) end }}
    else
        table.insert(item.buttons, { label = 'Place', action = function(slot) exports['kq_placeable_items']:placeItem(slot) end })
    end
end

return items

Last updated