SetPlayerNameplateTextFor
setPlayerNameplateTextFor
AVAILABLE FROM UPDATE 0.1.3
This function is available in G1R:MP 0.1.3 and later. The contract below includes the compatibility guarantees introduced in that update.
Overrides a target player's overhead text for one observer only.
Syntax
bool setPlayerNameplateTextFor(int observerId, int targetId, string text)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
observerId |
int |
yes | The connected human player who will see the label. |
targetId |
int |
yes | The different connected human player whose overhead label is controlled. |
text |
string |
yes | UTF-8 label; an empty string resets this pair's text override. |
Returns
Returns true when the server accepts the change or an identical owned no-op; false for invalid arguments/endpoints, ownership conflicts, unavailable service or exhausted limits. Acceptance is not a client-render acknowledgement.
Examples
Change only observer A's view of target B:
local accepted = setPlayerNameplateTextFor(observerId, targetId, "Known friend")
if not accepted then
outputDebugString("Nameplate override rejected")
end
Notes
- Available only in server-side resource scripts.
- The ordered pair is observer -> target; the reverse pair is independent. Both IDs must be distinct, connected session IDs, not persistent character IDs or NPC IDs.
- Each field resolves independently: explicit pair override, then the target's current global field, then the native default. Getters expose server policy, not whether pixels are currently rendered.
- No built-in acquaintance database or gamemode permission policy is assumed. See Observer nameplates for resource ownership, limits, persistence and privacy boundaries.
- A pair field is exclusively owned by the resource that first sets it. Another resource cannot overwrite or reset that field; other fields remain independent. An absent reset and an identical owned write are successful no-ops.
- Pair overrides survive leaving the synchronization range, but are cleared for both endpoints on disconnect and for their owning resource on stop. State is replayed reliably when the target becomes relevant again; no database persistence is automatic.
- Limits default to 250,000 active pairs globally and per resource, with a per-resource mutation token bucket of 4,096/s and an 8,192 burst. New/changed non-reset writes consume tokens; resets and cleanup do not. See the guide for configuration keys.
- Text is limited to 48 Unicode code points and 96 UTF-8 bytes. Invalid UTF-8, control characters,
<,>,&, byte-order marks, zero-width and bidirectional formatting characters rejected by the shared validator are not accepted. - Custom text never changes the canonical player name and does not implicitly hide the ID. Use setPlayerNameplateIdVisibleFor separately.
- PascalCase alias:
SetPlayerNameplateTextFor.