Tutorials

I am missing sql file how to add camping_objects table to my database ?

How to create a custom object in Config.CustomObjects ?

How to create usable item (beer cups, cooked smores and cooked meat) ?

1.

How to add camping_objects table in your database:

CREATE TABLE IF NOT EXISTS camping_objects (
    id INT AUTO_INCREMENT PRIMARY KEY,
    item VARCHAR(255) NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    `x` DOUBLE NOT NULL,
    `y` DOUBLE NOT NULL,
    `z` DOUBLE NOT NULL,
    `h` DOUBLE NOT NULL
)

2.

How to create a custom object ?

  1. Create new object in Config.CustomObjects:

    Example:
    Config.CustomObjects = {
        {
            label = 'Example Item',
            item = 'exampleitem',
            prop = 'exampleprop',
            target = 'Interact with this example object',
            distance = 2.5,
            offset = 0.50,
            menu = {
                {
                    title = 'Test Label',
                    description = 'Test Text',
                    icon = 'fas fa-circle-dot',
                    event = 'fivecode_camping:testtest',
                },
                {
                    title = 'Test Label 2',
                    description = 'Test Text 2',
                    icon = 'fas fa-circle-dot',
                    event = 'fivecode_camping:testEvent2'
                },
            },
        },
    }

  2. Add the item from your new object into your inventory: - Look into Installtion Guide if you need help with creating items for your inventory.

  3. Create custom event which will be triggered from the menu: - You can create it in any script on client side.

    Example:
    ---@param args entity
    
    RegisterNetEvent('fivecode_camping:testtest')
    AddEventHandler('fivecode_camping:testtest', function(args)
        print('Very cool text message!')
        print('Shop at https://fivecode.tebex.io/')
    end)
    
    RegisterNetEvent('fivecode_camping:testtest2')
    AddEventHandler('fivecode_camping:testtest2', function(args)
        local entity = args.entity
        print('Very cool entity: '..entity)
    end)
  4. Enjoy your new custom object!

3.

How to create usable items (smores and beer cups):

Change the following in: ox_inventory\data\items.lua

['fullbeercup'] = {
    label = 'Full Cup',
    weight = 1,
    stack = true,
    close = true,
    description = 'Full beer cup.'
},

to this:

['fullbeercup'] = {
    label = 'Full Cup',
    weight = 1,
    stack = true,
    close = true,
    description = 'Full beer cup.',
    client = {
        status = {thirst = 200000},
        anim = {dict = 'mp_player_intdrink', clip = 'loop_bottle'},
        prop = {model = 'prop_cs_paper_cup', pos = vec3(0.01, 0.01, 0.06), rot = vec3(15.0, 15.0, -75.0)},
        usetime = 2500,
    }
},

Change the following in: ox_inventory\data\items.lua

['cookedsmores'] = {
    label = 'Cooked Smores',
    weight = 1,
    stack = true,
    close = true,
    description = 'Cooked smores.'
},

to this:

['cookedsmores'] = {
    label = 'Cooked Smores',
    weight = 1,
    stack = true,
    close = true,
    client = {
        status = {hunger = 50000},
        anim = 'eating',
        prop = {model = 'fivecode_cookedsmores', pos = vec3(-0.02, 0.02, -0.03), rot = vec3(35.0, 55.0, -75.0)},
        usetime = 2500,
    },
},

Change the following in: ox_inventory\data\items.lua

['cookedmeat'] = {
    label = 'Cooked Meat',
    weight = 1,
    stack = true,
    close = true,
    description = 'Cooked meat.'
},

to this:

['cookedmeat'] = {
    label = 'Cooked Meat',
    weight = 1,
    stack = true,
    close = true,
    client = {
        status = {hunger = 250000},
        anim = 'eating',
        prop = {model = 'fivecode_cookedmeat', pos = vec3(-0.02, 0.02, -0.03), rot = vec3(15.0, 35.0, 75.0)},
        usetime = 5500,
    },
},

Last updated