Skip to content
This repository has been archived by the owner on Jul 7, 2023. It is now read-only.
/ msk_backpack Public archive

[ESX] Multiple Backpack Item

License

Notifications You must be signed in to change notification settings

Musiker15/msk_backpack

Repository files navigation

Not longer Supported

msk_backpack

[ESX] Multiple Backpack Items

Description

  • You can use the bag Item, then you get nobag Item and a Bag will be added to your Ped.
  • If you use nobag Item then then the Bag will be removed from your Ped an you get the bag Item.
  • Open own Bag with Command
  • Steal Bag from closest Player with Command
  • Works with Character Names not FiveM Names

Commands

Only if Config.BagInventory = 'secondary'!

  • /openbag - Open your own Bag
  • /stealbag - Open the Bag from Player next to you

Exports

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})

Requirements

Optional

Chezza Inventory only necessary if Config.BagInventory = 'secondary'!

Support for esx_ambulancejob

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)

My other Scripts

Paid

Free