FiveM Script - Multiple Backpack Items
- Forum: https://forum.cfx.re/t/release-esx-usable-backpack-item/4805469
- Discord Support: https://discord.gg/5hHSBRHvJE
- Preview 1: https://streamable.com/iog8fy
- Preview 2: https://streamable.com/61a8ur
- You can use the
bagItem, then you getnobagItem and a Bag will be added to your Ped. - If you use
nobagItem then then the Bag will be removed from your Ped an you get thebagItem. - Open own Bag with Command
- Steal Bag from closest Player with Command
- Works with Character Names not FiveM Names
Only if Config.BagInventory = 'secondary'!
/openbag- Open your own Bag/stealbag- Open the Bag from Player next to you
You can use the exports clientside AND serverside
-- Returns the itemName saved in database or nil if the player don't has a Bag
local hasBag = exports.msk_backpack:hasBag(player)Example
exports.msk_backpack:hasBag({source = playerId})
exports.msk_backpack:hasBag({identifier = playerIdentifier})
exports.msk_backpack:hasBag({player = xPlayer})Chezza Inventory only necessary if Config.BagInventory = 'secondary'!
This removes the Backpack after death, resets the inventory space and removes all items inside
Details
Go to /client/main.lua and search for function RespawnPed(ped, coords, heading).
Replace the function with this code:
function RespawnPed(ped, coords, heading, isDied)
SetEntityCoordsNoOffset(ped, coords.x, coords.y, coords.z, false, false, false)
NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, heading, true, false)
SetPlayerInvincible(ped, false)
ClearPedBloodDamage(ped)
TriggerServerEvent('esx:onPlayerSpawn')
TriggerEvent('esx:onPlayerSpawn')
TriggerEvent('playerSpawned')
if isDied then
TriggerServerEvent('msk_backpack:setDeathStatus', true)
end
endAbove this you find: function RemoveItemsAfterRPDeath().
Search for: RespawnPed(PlayerPedId(), RespawnCoords, ClosestHospital.heading)
Replace it with this: RespawnPed(PlayerPedId(), RespawnCoords, ClosestHospital.heading, true)