base.sh_base_equip
Equippable base item This is intended to act as a generic base or template for equippable items (items players can equip and de-equip) Unlike base_place, this is made using the new inventory feature and should be used as an example for any new bases.
This base isn't fully ready to be used as is, it is more intened as a "base for a base", for example clothing and weapons uses this as a base but adds more functionality. It isn't really possible to make this generic due to how many different equippable items there may be (some are SWEPs, some are clothing, some are accessories, some are weapon bases, etc...) That being said, it is possible to use as is if you just fill in the OnEquip and OnUnEquip functions with whatever you want. Just don't touch anything marked as private
Functions
CanPlayerEquip(item, client)
View source »Called when the player tries to equip this item, implement in child base/item
Parameters
-
item
Item
-
client
Player
Returns
-
boolean
If the item can be equipped
CanPlayerUnEquip(item, client)
View source »Called when the player tries to un-equip this item, implement in child base/item
Parameters
-
item
Item
-
client
Player
Returns
-
boolean
If the item can be un-equipped
EquipAction(item, client)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
item
Item
-
client
Player
EquipCondition(item, client)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
item
Item
-
client
Player
Returns
-
boolean
GetDropOnDeath()
View source »Gets if this item will drop on death
GetEquipSlot()
View source »Gets this item's equipment "slot", this is a string that represents a unique slot
GetEquipped(slot)
View source »Get a player's equipped item
Parameters
-
slot
string
optional
Slot to search for, if not specified will return all items
Returns
-
optional
Returns the item if slot was specified, or the entire table. If slot was specified, it may be nil
HandleDeathDropDefault(item, client)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
item
Item
-
client
Player
IsEquipped(item)
View source »Returns if this item is currently "equipped"
Parameters
-
item
Item
Returns
-
boolean
OnPlayerDeath(item, client)
View source »Called when the player dies if DropOnDeath is enabled, implement in child base/item if custom death override is enabled
Parameters
-
item
Item
-
client
Player
OnPlayerEquip(item, client)
View source »Called when the player equips this item, implement in child base/item. Return the entity created if this makes some sort of SWEP, it'll then automatically set the entity to the item and vice versa.
Parameters
-
item
Item
-
client
Player
Returns
-
optional
OnPlayerUnEquip(item, client)
View source »Called when the player un-equips this item, implement in child base/item If an entity was passed when equipped, this won't automatically remove it from the player, you'll need to do that yourself. This is to let you save any important data and such before removing it.
Parameters
-
item
Item
-
client
Player
PaintOver(panel, w, h, item)
View source »Used to paint a small icon to show this item is currently equipped
Parameters
-
panel
cityrp_invNew_Item
-
w
number
-
h
number
-
item
Item
SetDropOnDeath()
View source »Sets if this item should drop on death (default 0)
SetEquipSlot(equipSlot)
View source »Sets this item's equipment "slot"
Parameters
-
equipSlot
string
The name of the slot
SetEquipped(item, slot)
View source »Set something as being equipped by a player, intended for equip item use
Parameters
-
item
Item
-
slot
string
Slot to set the equipped item to
ToggleEquipState(item, state, ent)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
item
Item
-
state
boolean
-
ent
Entity
optional
UnEquipAction(item, client)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
item
Item
-
client
Player
UnEquipCondition(item, client)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
item
Item
-
client
Player
Returns
-
boolean
Tables
base_equip
View source »Documentation for this section is incomplete and needs expanding.
Fields
-
self
fun(self:
): GetDropOnDeath DEATH_DROP Gets if this item should drop on player death
-
self
fun(self:
): GetDropOnDeath DEATH_DROP Gets if this item should drop on player death
-
self
fun(self:
): GetDropOnDeath DEATH_DROP Gets if this item should drop on player death
-
self
fun(self:
): GetDropOnDeath DEATH_DROP Gets if this item should drop on player death