players.setPlayerMarkerForViewer
Sets the color in which one player (the viewer) sees another player’s (the target’s) radar marker. Only the viewer sees it. It lasts until you clear it or either player leaves.
Renamed in 0.28 from players.setMarkerForPlayer; see renamed names.
Signature
Section titled “Signature”players.setPlayerMarkerForViewer( viewer: PlayerTarget, target: PlayerTarget, colorRgba: number | null,): Promise<ActionResult>Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
viewer |
PlayerTarget |
The player who sees the marker. |
target |
PlayerTarget |
The player the marker shows; not the viewer. |
colorRgba |
number or null |
0xRRGGBBAA, from 0x00000000 to 0xFFFFFFFF; alpha 0 hides the marker. null clears the color you set. |
A color you set wins over playerMarkerVisibilityRequest, but the
marker still shows only within the marker settings. After null,
your last playerMarkerVisibilityRequest answer applies again.
Returns
Section titled “Returns”A promise of an ActionResult: applied when the color is set or cleared, or
rejected with a code.
| Rejection code | Meaning |
|---|---|
invalid-target |
target is missing, not a player, or the viewer. |
invalid-colour |
colorRgba is not 0 to 0xFFFFFFFF. |
player-not-found |
The viewer or the target is not on the server. |
Example
Section titled “Example”import { players } from "nativemp";
// Viewer 1 sees target 7 as opaque orange.await players.setPlayerMarkerForViewer(1, 7, 0xFF8800FF);
// Alpha zero hides target 7 for viewer 1.await players.setPlayerMarkerForViewer(1, 7, 0xFF880000);
// Back to the default.await players.setPlayerMarkerForViewer(1, 7, null);The marker color is separate from the player’s name color.
Related
Section titled “Related”playerMarkerVisibilityRequest: hide a player from a viewerworld.getPlayerMarkerSettings: the marker mode and rangeplayers.setNameColor: the name color