Weapon System

For this section, if you do not have the minimum knowledge, or an experienced developer, avoid modifying or integrating custom weapons to your server to avoid errors, or problems with the inventory resource, with this we make clear that a support will not help you to configure a section like this to your server.

Both esx and qbcore will use config/weapons.lua, since this inventory is not compatible with external weapon assets such as qb-weapons or other similar ones.

Quasar inventory provides you with a wide and configured weapon system, without the need to have another resource, DLC or buy any system, and the inventory incorporates it in the best way giving you a taste of the gameplay.

We can find much of the system fully configurable, but avoid editing part of this configuration if you do not have the basic skills or experience in the code.

How do I configure the weapons system?

We have 3 main options very requested by the users, among them we have the configuration of ammunition limitation, this option limits you to a single clip in the weapon, which makes the experience more real in confrontations.

You can enable and disable the reload progressbar, this is more for those people who are bothered by a reload bar every time you reload your weapon, also you can reduce the reload time of the weapon in milliseconds, to the taste of each server.

Config.LimitAmmo = true -- If you enable this feature, it will only allow one full magazine per weapon
Config.ReloadProgressbar = true -- Reload weapon from progressbar
Config.ReloadTime = math.random(2000, 3000) -- Reload progressbar
Durability and multiplier settings

You can add individually to each weapon, the duration for the weapon to break, the higher the number, the faster the weapon will break, so this is a fully configurable option for the convenience of each server.

-- Default config example
Config.DurabilityMultiplier = {
    ['weapon_pistol']                = 0.10,
    ['weapon_pistol_mk2']            = 0.10,
    ['weapon_pistolxm3']             = 0.10,
    ['weapon_combatpistol']          = 0.10,
}
I cannot apply bullets or weapons to my weapon

If you run the inventory completely by default, this problem will not occur, therefore what happens to you is a modification or a break in your items or weapons. We recommend that you always use the default items and weapons and only add more, never replace or delete if you are not a programmer with advanced knowledge.

Can I use the weapon wheel in qs-inventory?

No, this is not possible due to the advanced weapon and item metadata system we use. GTA V does not support metadata, therefore its weapon wheel is not compatible either.

How do I edit the damage of weapons and their recoil?

This is not something that should be edited from the inventory, since they are native to GTA V, if you want to edit these parameters you can do so from external assets that you can find both on GitHub and on the Cfx.re forum.


Weapons addon system

Now knowing that some basic skills are expected for this, we will make it as a brief guide and explained in the best way for users of our inventory can get to get varieties of weapons.

With the first step you have to add your weapon as an item to the ESX system and validate that the weapon you are adding the owners of the store or the weapon they sold you or offer you add a small basic guide to add the weapon to the ESX system.

As a second step now we will begin the configuration of the new weapon in the quasar inventory, so we will proceed to go to qs-inventory-inventory-shared-items.lua and add the weapon, as an example we will take the name of the AK47 weapon.

['weapon_ak47'] = {
    ['name'] = 'weapon_ak47',
    ['label'] = 'AK47',
    ['weight'] = 1000,
    ['type'] = 'weapon',
    ['ammotype'] = 'AMMO_RIFLE',
    ['image'] = 'weapon_ak47.png',
    ['unique'] = true,
    ['useable'] = false,
    ['description'] = 'AK47'
},

As a third step, we will now add the weapon in qs-inventory\inventory\shared\weapons.lua following the same example above with the name AK47.

[`weapon_ak47`] = {
    ['name'] = 'weapon_ak47',
    ['label'] = 'AK47',
    ['ammotype'] = 'AMMO_RIFLE',
    ['damagereason'] = 'Ended / Rifled / Shot down / Floored'
},

In the fourth step we have the integration of the Usable Items, and for this in the Addon attachments section is fully explained for you to understand them, but to continue with the tutorial of implementation of a custom weapon, we will make the example that our example weapon comes with 4 attachments so this will add it in qs-inventory\server\custom\misc\CreateUsableItem.lua.

-- Mag
CreateUsableItem('custom-ak47-mag1', function(source, item)
    TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'clip1')
end)

-- Scopes
CreateUsableItem('custom-ak47-scope1', function(source, item)
    TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'scope1')
end)

-- Body
CreateUsableItem('custom-ak47-body1', function(source, item)
    TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'frame1')
end)

CreateUsableItem('custom-ak47-body2', function(source, item)
    TriggerClientEvent('weapons:client:EquipAttachment', source, item, 'frame2')
end)

In the addon attachments section, you will find the different categories that you can assign to your attachments, this to be able to place some of these items in the attachment slot of the weapon.

And as last step, we have the configuration of the weapon in the weapons.lua, where we will assign the durability of the weapon and assign the corresponding attachments that can be assigned, you can find the file mentioned in qs-inventory\config\weapons.lua.

-- Weapon is added in the durability system
Config.DurabilityMultiplier = {
    ['weapon_ak47']                = 0.10,
}

-- And add the weapon with the attachments it comes with and configure in CreateUsableItems.lua
Config.WeaponAttachments = {
    ['WEAPON_MB47'] = {
        -- Mag
        ['clip1'] = {
            component = 'COMPONENT_CUSTOM_AK47_CLIP_01',
            label = 'AK47 Mag 1',
            item = 'custom-ak47-mag1',
        },
        ['scope1'] = {
            component = 'COMPONENT_CUSTOM_AK47_SCOPE_01',
            label = 'AK47 Scope 2',
            item = 'custom-ak47-scope1',
        },
        ['frame1'] = {
            component = 'COMPONENT_CUSTOM_AK4_BODY_01',
            label = 'AK47 Body 2',
            item = 'custom-ak47-body1',
        },
        ['frame2'] = {
            component = 'COMPONENT_CUSTOM_AK4_BODY_02',
            label = 'AK47 Body 2',
            item = 'custom-ak47-body2',
        },
    }
}

And if all goes well, you now have a custom weapon with 4 attachments ready to use with our inventory system, so we hope this will motivate the community to bring varied content.

Last updated