Addon attachments

Welcome to Addon attachments

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.

Make sure you have the items already added to the ESX and also to the inventory in shared/items.lua

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

Example Default Categories

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

Example of implementing a custom attachment

  • First the integration is done in [inventory]\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