FiveM Script - Multiple Backpack Items
bag
Item, then you get nobag
Item and a Bag will be added to your Ped.nobag
Item then then the Bag will be removed from your Ped an you get the bag
Item.Only if Config.BagInventory = 'secondary'
!
/openbag
- Open your own Bag/stealbag
- Open the Bag from Player next to youYou 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
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
end
Above this you find: function RemoveItemsAfterRPDeath()
.
Search for: RespawnPed(PlayerPedId(), RespawnCoords, ClosestHospital.heading)
Replace it with this: RespawnPed(PlayerPedId(), RespawnCoords, ClosestHospital.heading, true)