SetPlayerNameplateText: Difference between revisions
Jump to navigation
Jump to search
Document Protocol 23 voice and player presentation APIs |
Document universal per-observer nameplates and test resource available from update 0.1.3 |
||
| Line 1: | Line 1: | ||
= setPlayerNameplateText = | = setPlayerNameplateText = | ||
Changes a player's server-authoritative overhead nameplate text. | Changes a player's server-authoritative overhead nameplate text. | ||
| Line 18: | Line 17: | ||
== Returns == | == Returns == | ||
Returns <code>true</code> when the text was accepted | Returns <code>true</code> when the global text was accepted; otherwise returns <code>false</code>. This is not a client-render acknowledgement. | ||
== Examples == | == Examples == | ||
| Line 31: | Line 30: | ||
* Control characters, HTML delimiters, ampersands, byte-order marks and bidirectional formatting characters are rejected. | * Control characters, HTML delimiters, ampersands, byte-order marks and bidirectional formatting characters are rejected. | ||
* The reliable state is replayed during relevance entry and late join. | * The reliable state is replayed during relevance entry and late join. | ||
* Changes the global fallback only. An explicit [[setPlayerNameplateTextFor|per-observer text override]] still wins; visibility and ID policy are preserved. Custom text does not automatically hide the numeric ID. | |||
[[Category:Lua Functions]] | [[Category:Lua Functions]] | ||
Latest revision as of 03:08, 9 September 2026
setPlayerNameplateText
Changes a player's server-authoritative overhead nameplate text.
Syntax
bool setPlayerNameplateText(int playerId, string text)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
text |
string |
yes | Validated UTF-8 text, or an empty string to restore the default player name. |
Returns
Returns true when the global text was accepted; otherwise returns false. This is not a client-render acknowledgement.
Examples
Show a roleplay label:
setPlayerNameplateText(playerId, "Militia Guard")
Notes
- Available only in server-side resource scripts.
- Text is limited to 48 Unicode code points and 96 UTF-8 bytes.
- Control characters, HTML delimiters, ampersands, byte-order marks and bidirectional formatting characters are rejected.
- The reliable state is replayed during relevance entry and late join.
- Changes the global fallback only. An explicit per-observer text override still wins; visibility and ID policy are preserved. Custom text does not automatically hide the numeric ID.