Tutorials

I am missing sql file how to add armor column into my users table in my database ?

How to create new vests ?

How to add vests into shops ?

How to give somebody vest through export or /givevest command ?

How to remove player vest ?

How to undress[steal] vest from player ?

How to create a armor box ?

1.

How to add armor column into your users table in your database ?

ALTER TABLE `users` ADD COLUMN IF NOT EXISTS `armor` LONGTEXT DEFAULT NULL;

2.

How to create new vests ?

! Some Inventories can only have one 'item' and are not able to change 'image' and 'weight' !

  1. Create new vest in config.lua: - If you dont want to create a new vest type you can take an example from bulletproofvest and add a new vest to an already existing type.

    Config.Vests = {    
        ['bulletproofvest'] = {
            police = {label = 'Police Vest', weight = 3000, clothNumber = 1, clothColor = 1, image = 'armor', maxArmor = 100},
            vest = {label = 'Bulletproof Vest', weight = 4000, clothNumber = 1, clothColor = 1,  image = 'armorpd', maxArmor = 80}
        },
        ['armor'] = {
            armor = {label = 'Armor', description = 'Medium Armor', weight = 4000, clothNumber = 1, clothColor = 1, image = 'armor', maxArmor = 50}
        },
        ['example_vests'] = {
            examplevest1 = {label = 'Vest', description = 'Example Vest', weight = 4000, clothNumber = 1, clothColor = 1, image = 'examplevest1', maxArmor = 100}
        }
    }
  2. Create a new item with your vests name in your inventory: - In this example it will be example_vest_type. - Look into Installtion Guide if you need help with creating items for your inventory.

  3. Give yourself the vest:

    -- 1: player id
    -- 2: Vest item
    -- 3: Vest name
    /givevest 1 example_vests examplevest1
  4. Enjoy!


3.

How to add vests into shops ?

ox_inventory/data/shops.lua

{
    name = 'bulletproofvest',  -- Vest type.
    price = 2500,
    amount = 1,
    metadata = {
        type = 'police',       -- Vest name in type.
        label = 'Police Vest',
        armor = 100,
        maxArmor = 100,
    },
    type = 'item',
    slot = 8,
    requiresLicense = false
},
{name = 'bulletproofvest', price = 2500, amount = 1, metadata = {type = 'police', label = 'Police Vest', armor = 100, maxArmor = 100}, type = 'item', slot = 8, requiresLicense = false},

4.

Give somebody vest item:

Command:

-- 1: Player id
-- 2: Vest item [from config]
-- 3: Vest name [from config]
/givevest 1 bulletproofvest police

Export:

---@param item [your_item_vest]
---@param type [type_of_vest]
-- Make sure you have created the vest in config file!!!
exports.fivecode_armor:GiveVest(item, type)

5.

Remove player vest:

exports.fivecode_armor:RemoveVest()

6.

Steal player vest:

-- 1: Player source
-- 2: Second player source
exports.fivecode_armor:UndressVest(sourceFor, sourceFrom)

7.

How to create a armor box ?

  1. Create new item in your inventory: - In this example it will be example_armorbox. - Look into Installtion Guide if you need help with creating items for your inventory.

  2. Make the item usable:

    Add the following into: ox_inventory/modules/items/client.lua

    Item('example_armorbox', function(data, slot)
        ox_inventory:useItem(data, function(data)
    	if data then
    	    exports.fivecode_armor:GiveVest('example_vests', 'examplevest1')
    	end
        end)
    end) 

    - If you need any help with GiveVest export check this.

  3. Enjoy!


Additional info:

1. When adding plates to your shop, you can use metadata to modify the strength with
which they restore the durability of the vest. - 'strength'

If you need help with anything, do not hesitate and open a support ticket in our discord.

Last updated