Defines skin_base, the base item for clothing that is worn by setting the skin of the player's model.

Derived items set playerSkin, and optionally protection (percent of damage absorbed) and isCombine (Combine players can only wear items marked with it). Wearing goes through Player:SetSkinClothes, the item stays in the inventory, and it is taken off, resetting the skin to 0, when dropped, sold, stored, unequipped or taken from the inventory in any other way.

Originally written for the Global Cooldown community.

Summary

Methods

Takes the item off when it is put into storage while worn.
Takes the item off when it is sold while worn.
Returns whether the player wears this item instance as their skin.
Sets or resets the player's skin and calls the item's OnChangedClothes if it has one.
Takes the item off when it is dropped while worn.
Takes the item off when the player unequips it.
Takes the item off when it is taken from the player's inventory while worn.
Wears the item with Player:SetSkinClothes and keeps it in the inventory.
Resets the player's skin to 0.
Sets the player's skin, or tells them they cannot wear the item if the model lacks it.

Methods

ITEM:CanGiveStorage(player, storageTable)

shared gamemodes/cwhl2rp/plugins/clothes/plugin/items/sh_skin_base.lua:91

Takes the item off when it is put into storage while worn.

Parameters

  • player
  • storageTable

Takes the item off when it is sold while worn.

Parameters

  • player

ITEM:HasPlayerEquipped(player, bIsValidWeapon)

shared gamemodes/cwhl2rp/plugins/clothes/plugin/items/sh_skin_base.lua:122

Returns whether the player wears this item instance as their skin.

Uses the networked skinClothesData on the client.

Parameters

  • player Player The player to check
  • bIsValidWeapon Boolean Unused

Returns

  • Boolean Whether the item is worn

ITEM:OnChangeClothes(player, bIsWearing)

shared gamemodes/cwhl2rp/plugins/clothes/plugin/items/sh_skin_base.lua:103

Sets or resets the player's skin and calls the item's OnChangedClothes if it has one.

Parameters

  • player Player The wearer
  • bIsWearing Boolean Whether the item is being put on

Takes the item off when it is dropped while worn.

Parameters

  • player
  • position

ITEM:OnPlayerUnequipped(player, extraData)

shared gamemodes/cwhl2rp/plugins/clothes/plugin/items/sh_skin_base.lua:140

Takes the item off when the player unequips it.

Parameters

  • player
  • extraData

Takes the item off when it is taken from the player's inventory while worn.

Parameters

  • player

Wears the item with Player:SetSkinClothes and keeps it in the inventory.

Combine players can only wear items marked isCombine, and dead or ragdolled players cannot wear anything.

Parameters

  • player
  • itemEntity

Returns

  • Boolean true when worn, false otherwise; either way the item is kept

Resets the player's skin to 0.

Parameters

  • player Player The wearer

Returns

  • Boolean Always true

Sets the player's skin, or tells them they cannot wear the item if the model lacks it.

Parameters

  • player Player The wearer
  • skin Number The skin index

Returns

  • Boolean Whether the skin was set

Defined in