SetPlayerArmor: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Automatyczna aktualizacja dokumentacji funkcji
 
Document 0.1a Lua API, identities, moderation and synchronized spells
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<!-- This page is generated automatically from the function definition: setPlayerArmor. -->
= setPlayerArmor =
= setPlayerArmor =
Equips or clears a player's authoritative armor slot.
Equips or clears a player's authoritative armor slot.
Line 39: Line 38:
* The player must own at least one copy of a non-empty item before it can be equipped.
* The player must own at least one copy of a non-empty item before it can be equipped.
* The selected appearance is reliably synchronized and included in late-join state.
* The selected appearance is reliably synchronized and included in late-join state.
* Gothic Remake character variants have identity-specific armor support. Not every identity/armor combination exists or renders correctly; test every combination exposed by a resource.


[[Category:Lua Functions]]
[[Category:Server Functions]]
[[Category:Server Functions]]
[[Category:Player Functions]]
[[Category:Player Functions]]
[[Category:Inventory Functions]]
[[Category:Inventory Functions]]
[[Category:Equipment Functions]]
[[Category:Equipment Functions]]

Latest revision as of 11:36, 27 August 2026

setPlayerArmor

Equips or clears a player's authoritative armor slot.

Syntax

bool setPlayerArmor(int playerId, string itemKey)

Parameters

Name Type Required Description
playerId int yes The connected player identifier.
itemKey string yes A key returned by getPlayerArmorNames, or "none" to clear the slot.

Returns

Returns true when the equipment change is accepted and replicated; otherwise returns false.

Examples

Example 1

Give an item and equip it in the armor slot:

local itemKey = "water_robe"
if givePlayerItem(playerId, itemKey) then
    setPlayerArmor(playerId, itemKey)
end

Example 2

Clear the armor slot:

setPlayerArmor(playerId, "none")

Notes

  • Available only in server-side resource scripts.
  • The player must own at least one copy of a non-empty item before it can be equipped.
  • The selected appearance is reliably synchronized and included in late-join state.
  • Gothic Remake character variants have identity-specific armor support. Not every identity/armor combination exists or renders correctly; test every combination exposed by a resource.