GetPlayerItemHealth
The condition of the player’s item of a class.
In percent: 0 = broken, 100 = new. When they carry several items of the class, the one they wear answers first, else the one
they have had longest. The condition is the server’s record: their game reports every whole percent its items wear or are
mended, and a GivePlayerItem still on its way already answers with the condition it was given at.
The percent is the one the game’s inventory shows: each item is measured between its own worst and its best, so 100 is as good as that item can be (new, or fully repaired) whatever its kind and quality, and a number means the same wear on every item.
The id of one of the player’s tagged items (GivePlayerTaggedItem) in place of the class answers for that one item.
Syntax
Section titled “Syntax”GetPlayerItemHealth(pid, item)| Parameter | Type | |
|---|---|---|
pid |
number | the player |
item |
string | number | the item’s name, id, English name or GUID - or a tagged item’s id |
Returns
Section titled “Returns”number - 0..100; nil when they carry none of it
Example
Section titled “Example”local health = GetPlayerItemHealth(pid, "shortswordBroad")if health and health < 25 then SendClientMessage(pid, COLOR_RED, "Your sword is about to break.")endSee also
Section titled “See also”SetPlayerItemHealth · OnPlayerItemWear · GetPlayerInventory · the Items and inventory group of the index
