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
OnChangedClothes if it has one.Player:SetSkinClothes and keeps it in the inventory.Methods
ITEM:CanGiveStorage(player, storageTable)
shared gamemodes/cwhl2rp/plugins/clothes/plugin/items/sh_skin_base.lua:91Takes 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:122Returns 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:103Sets 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
ITEM:OnDrop(player, position)
shared gamemodes/cwhl2rp/plugins/clothes/plugin/items/sh_skin_base.lua:73Takes 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:140Takes the item off when the player unequips it.
Parameters
- player
- extraData
ITEM:OnTakeFromPlayer(player)
shared gamemodes/cwhl2rp/plugins/clothes/plugin/items/sh_skin_base.lua:145Takes the item off when it is taken from the player's inventory while worn.
Parameters
- player
ITEM:OnUse(player, itemEntity)
shared gamemodes/cwhl2rp/plugins/clothes/plugin/items/sh_skin_base.lua:54Wears 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
truewhen worn,falseotherwise; either way the item is kept
Resets the player's skin to 0.
Parameters
- player Player The wearer
Returns
- Boolean Always
true
ITEM:SetSkin(player, skin)
shared gamemodes/cwhl2rp/plugins/clothes/plugin/items/sh_skin_base.lua:27Sets 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