ScriptsM Backpacks

ScriptsM Backpacks

This script will allow you to wear backpacks, bags and increase your inventory slots. You can configure custom backpack models for your server.

Installation

Download a resource (opens in a new tab) from keymaster or buy it by buttons at the top

Install all resource dependencies

Setup database

Import backpacks.sql into your database. It's important to save character backpacks and load them on character spawn.

It's important for your resources to start in a logical order to prevent errors from missing dependencies.

Resource start order

It's important for your resources to start in a logical order to prevent errors from missing dependencies.

start ox_inventory
start ScriptsM-BackPacks

Using with QB Inventory

Go to qb-inventory/client/main.lua

Add this code after all local variables:

Config.MaxInventorySlots = 20
 
Config.MaxInventoryWeight = 20000
 
local function SetSlotCount(slotcount)
    Config.MaxInventorySlots = slotcount
end
 
exports('SetSlotCount', SetSlotCount)
 
local function SetMaxWeight(maxweight)
    Config.MaxInventoryWeight = maxweight
end
 
exports('SetMaxWeight', SetMaxWeight)

In Config.MaxInventorySlots and Config.MaxInventoryWeight set your values from config.lua

Config

There you can find an config of resource with description for all params

Config = {}
 
Config.DefaultWeight = 10000 -- Default inventory weight
 
Config.DefaultSlots = 10 -- Default inventory slots
 
Config.BackPackNotEmptyNotify = function() -- Custom notification export, calls when player try to remove backpack, but it's not empty
exports['t-notify']:Alert({
    style = 'error',
    message = 'You cannot remove backpacks, because its not empty',
    duration = 5500
})
end
 
Config.AlreadyHaveBackpackNotify = function() -- Custom notification export, calls when player try to wear another backpack, but already have backpack on him
exports['t-notify']:Alert({
    style = 'error',
    message = 'You already have backpack on you',
    duration = 5500
})
end
 
Config.EquipAnim = { -- Backpack equip animation
  dict = 'clothingtie',
  anim = 'try_tie_negative_a'
}
 
Config.BackPacks = { -- There you can set your custom backpacks.
  { 
  itemname = 'backpack', -- inventory item name
  drawableid = 8, -- Drawable id, can be found here: https://docs.fivem.net/natives/?_0x67F3780DD425D4FC
  clothslot = 2, -- Clothing slot of backpack
  clothtexture = 0, -- Clothing texture
  slots = 15, -- Slots of inventory if you wearing backpack
  weight = 20000 -- Weight of inventory if you wearing backpack
  },
  {
  itemname = 'bag',
  drawableid = 5,
  clothslot = 86,
  clothtexture = 1,
  slots = 25,
  weight = 40000
  },
}