Module cityrp.inventory

Inventory Management

Module Overview

Client Fields

cityrp.inventory.stored Items currently stored on the client.
cityrp.inventory.updatePanel If the panel requires updating.

Client Functions

cityrp.inventory.getMaximumSpace() Get the maximum inventory space of the local player.
cityrp.inventory.getSize() Get the currently used inventory space of the local player.
cityrp.inventory.canFit(size) Check if a certain size will fit in the local player's inventory.

Server Functions

cityrp.inventory.update(ply, unique, amount, Meta[, force=false]) Update a player's inventory with a given amount of item.
cityrp.inventory.updateMeta(ply, unique, amount, meta, newmeta) Update a player's inventory meta.
cityrp.inventory.getMaximumSpace(player) Get the maximum amount of space a player has.
cityrp.inventory.getSize(player) Get the currently used amount of space a player has.
cityrp.inventory.canFit(ply, size) Check if a certain size will fit in the local player's inventory.
cityrp.inventory.sizeAlert(player, size) Check that a player may be closs to their limit and warn them.
cityrp.inventory.sizeAlertFull(player, size) Check that a player is at to their limit and warn them.

Client Fields

cityrp.inventory.stored
Items currently stored on the client.
cityrp.inventory.updatePanel
If the panel requires updating.

Client Functions

cityrp.inventory.getMaximumSpace()
Get the maximum inventory space of the local player.

Returns:

    number Inventory size.
cityrp.inventory.getSize()
Get the currently used inventory space of the local player.

Returns:

    number Inventory use.
cityrp.inventory.canFit(size)
Check if a certain size will fit in the local player's inventory.

Parameters:

  • size number The size to check fitting.

Returns:

    boolean If the given size will fit.

Server Functions

cityrp.inventory.update(ply, unique, amount, Meta[, force=false])
Update a player's inventory with a given amount of item.

Parameters:

  • ply Player The player whos inventory we're updating.
  • unique string The item class to give.
  • amount number The number of items to give.
  • Meta string data
  • force bool Whether to bypass size limits. (default false)
cityrp.inventory.updateMeta(ply, unique, amount, meta, newmeta)
Update a player's inventory meta.

Parameters:

  • ply Player The player whos inventory we're updating.
  • unique string The item class to change.
  • amount number The number of items to change.
  • meta string The meta data for item(s) to change.
  • newmeta string The meta data to change the item(s) to.
cityrp.inventory.getMaximumSpace(player)
Get the maximum amount of space a player has.

Parameters:

  • player Player Player to retrieve space for.

Returns:

    number The inventory space of the player.
cityrp.inventory.getSize(player)
Get the currently used amount of space a player has.

Parameters:

  • player Player Player to retrieve space for.

Returns:

    number The inventory space of the player.
cityrp.inventory.canFit(ply, size)
Check if a certain size will fit in the local player's inventory.

Parameters:

  • ply Player The player to check.
  • size number The size to check fitting.

Returns:

    boolean If the given size will fit.
cityrp.inventory.sizeAlert(player, size)
Check that a player may be closs to their limit and warn them.

Parameters:

  • player Player The player to check.
  • size number The size to check fitting.

Returns:

    boolean If the warning was issued.
cityrp.inventory.sizeAlertFull(player, size)
Check that a player is at to their limit and warn them.

Parameters:

  • player Player The player to check.
  • size number[opt] unused

Returns:

    boolean If the warning was issued.