CityRP Documentation Repository

ITEM.Accessory

The accessory item base. Contains helpers for equipping, removing and expiring accessories.

Registration ID
base_accessory
Inherits
ITEM → ITEM.Accessory

Functions

SharedITEM:canDestroy(ply, amt) → boolean, string?Source ☍

canDestroy hook/override for this item base. Refuses destroying the last copy of an accessory the player is still wearing.

Parameters

Returns

  1. 1boolean
  2. 2string?
SharedITEM:canDrop(ply, pos, amt) → boolean, string?Source ☍

canDrop hook/override for this item base.

Parameters

Returns

  1. 1boolean
  2. 2string?
SharedITEM:canGive(ply, amt, to) → boolean, string?Source ☍

canGive hook/override for this item base.

Parameters

Returns

  1. 1boolean
  2. 2string?
SharedITEM:canLoseWornCopies(ply, amt) → boolean, string?Source ☍

Whether the player can lose amt copies without wearing an accessory they no longer hold.

Parameters

  • plyPlayer
  • amtnumberCopies leaving the inventory.

Returns

  1. 1boolean
  2. 2string?
SharedITEM:generateTimer(time, ply, func, name)Source ☍

Generate a unique timer for an action, player and item set. Removes and resets the existing timer if it exists.

Parameters

  • timenumberHow long to run this timer for.
  • plyPlayerPlayer we're running this timer for.
  • funcfunctionCallback function when timer expires.
  • namestring?Timer name.
SharedITEM:generateTimerName(ply, name) → stringSource ☍

Generate a timer name, unique for an action, player and item.

Parameters

  • plyPlayerPlayer to generate the timer for.
  • namestring?Name of the timer.

Returns

  1. stringName
SharedITEM:onDestroy(ply)Source ☍

onDestroy hook/override for this item base.

Parameters

SharedITEM:onDrop(ply, pos)Source ☍

onDrop hook/override for this item base.

Parameters

SharedITEM:onGive(ply, pos)Source ☍

onGive hook/override for this item base.

Parameters

SharedITEM:onRemove(ply) → booleanSource ☍

onRemove hook/override for this item base.

Parameters

Returns

  1. boolean
SharedITEM:onUse(ply) → booleanSource ☍

onUse hook/override for this item base.

Parameters

Returns

  1. boolean

Fields

SharedITEM.SetExpireEmoteSource ☍

Set the Emote used when when this accessory expires.

SharedITEM.SetExpiresSource ☍

Set the time that this accessory takes to expire.

SharedITEM.SetOffEmoteSource ☍

Set the Emote used when when this accessory is removed.

SharedITEM.SetOnEmoteSource ☍

Set the Emote used when when this accessory is used.

SharedITEM.SetPostExpireSource ☍

Set the function called after this item expires.

SharedITEM.SetPostRemoveSource ☍

Set the function called after this item is removed.

SharedITEM.SetPostUseSource ☍

Set the function called after this item is used.

SharedITEM.SetSingleUseSource ☍

Sets if this item is single use.