Attachments 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.

Quasar Inventory includes many attachments by default, if not all of the current GTA V ones, but you can still add new attachments to weapons or custom weapons by following the guide below. Please note that sometimes non-customized weapons are not fully functional and this is not the fault of the inventory.

My addon weapons accessories are not fully working

After following this guide completely, if your addon weapons do not have fully functional attachments, it is due to having changed the weapon prefixes, missing somewhere in this guide, or simply the weapon is not fully functional.

If you have problems like these, we recommend that you directly go to the seller or supplier of the addon weapons and ask them to do the complete integration for you.

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.


Default attachment categories

Default Categories are the spaces where you can add an attachment such as scope, suppressor, flash, clip and tint. In this we emphasize that only by these names are the slots where the attachment item goes are recognized.


Optional attachment categories

The optional categories are the name of the attachments that come configured with some custom weapons, referring to the name or category of the attachment. The optional categories are compatible with the default categories, so it is recommended not to edit these names.

In this way we want to visually explain the categories in which the custom attachments will be categorized based on the default slots with the help of the previous image.


Add attachments addons

First the integration is done in qs-inventory\server\custom\misc\CreateUsableItem.lua.

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

frame2 is the category where the attachment will be placed, and "frame2" is used to identify this category since you cannot repeat the "frame" category on the same weapon and "frame2" is used for identification, so if you want to add more attachments, you can add the "frame3" and so on continuously

Now add the configuration to weapons.lua in the config folder.

Config.DurabilityMultiplier = {
    ['weapon_ak47']      = 0.15,
}

Config.WeaponAttachments = {
    ['WEAPON_AK47'] = {
        ['frame2'] = {
            component = 'COMPONENT_CUSTOM_AK47_BODY_02',
            label = 'AK47 Frame 2',
            item = 'custom-mb47-body2',
        },
    }
}

Be careful and verify that where you bought the gun, or where you downloaded it, they give you a basic configuration where you can see the component that can be used, since this must come with the files of the gun, otherwise, the attachment will never load visually on the gun.

Last updated