playerMarkerVisibilityRequest
Asks your gamemode whether a viewer may see a target player’s radar marker. It is asked when the target comes within the viewer’s marker range (see player marker settings), not every frame. The answer is kept for that pair: when the target leaves the range and comes back, your last answer applies at once and the server asks again.
Renamed in 0.28 from playerMarkerRequest; see renamed names.
Signature
Section titled “Signature”server.on("playerMarkerVisibilityRequest", ({ viewer, target, defaultVisible }) => boolean | Promise<boolean>)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
viewer |
PlayerSnapshot |
The player who would see the marker. |
target |
PlayerSnapshot |
The player the marker shows. |
defaultVisible |
boolean |
What the server would do without you: true for now. |
Returns
Section titled “Returns”true shows the marker, false hides it from this viewer. With several handlers, any false hides it. See
how decisions work.
Example
Section titled “Example”Nobody but player 1 sees player 7.
import { server } from "nativemp";
server.on("playerMarkerVisibilityRequest", ({ viewer, target }) => viewer.id === 1 || target.id !== 7);When it is asked
Section titled “When it is asked”The server asks only when all of these hold:
- the viewer and the target are two different players, both alive and in the world;
- both are in the same interior;
- the target is within the marker radius, unless the radius is
null(no limit); - in
streamedmode, the target is close enough for the viewer’s game to show them (300 m to come in, 350 m to go).
A marker that shows stays until the target is 10% beyond the radius, so it does not flicker at the edge. In off mode
nobody is asked. When your gamemode reloads, every pair is asked again.
Related
Section titled “Related”world.getPlayerMarkerSettings: the marker mode and radiusplayers.setPlayerMarkerForViewer: one pair’s marker colorvehicleMarkerAppearanceRequest: vehicles’ markers