Skip to content

A3D_GetPlayersOnScreen

imshooter edited this page Oct 17, 2026 · 1 revision

Find the players on the screen of a player, nearest first, in the same virtual world and interior.

A player is measured at the height of the chest.

native A3D_GetPlayersOnScreen(
    playerid,
    players[],
    size = sizeof (players),
    bool:sight = false,
    Float:range = 300.0
);

Parameters

Parameter Description Default
playerid Player whose screen it is.
players[] The players found.
size Room in players. sizeof (players)
bool:sight Whether the camera must see them, with the map and static objects in the way. false
Float:range How far from the camera to look. 300.0

Returns

  • The number of players written.

Remarks

A player shows when their chest lies on the screen, within range of the camera, in the same virtual world and interior. The viewer is left out, and so are players who are not spawned, are dead or spectate. With sight, players behind the map or a static object are left out too. The players are written nearest to the camera first.

Example

Shows the enemies a player sees on the radar of that player only.

stock SpotEnemies(playerid) {
    new
        players[MAX_PLAYERS],
        count = A3D_GetPlayersOnScreen(playerid, players, .sight = true, .range = 150.0)
    ;

    for (new i; i != count; ++i) {
        if (GetPlayerTeam(players[i]) == GetPlayerTeam(playerid)) {
            continue;
        }

        SetPlayerMarkerForPlayer(playerid, players[i], 0xFF0000FF);
    }
}

Related

  • A3D_GetVehiclesOnScreen: Find the vehicles on the screen of a player, nearest first, in the same virtual world and interior, leaving out the one they are in.
  • A3D_GetActorsOnScreen: Find the actors on the screen of a player, nearest first, in the same virtual world.
  • A3D_GetPlayersInCone: Find the players inside a cone, such as the view of a guard or the spread of a shotgun, nearest first.

Home

Guides

Reference

Functions

Creating objects
Motion
Placement
Behaviour
Display and data
Rays
Shapes
Players, vehicles and actors
Map probes
Screen
Map objects
Water
Models and surfaces
Rotations and offsets
Vehicles
Routes
Route display
Walking
Callbacks

Clone this wiki locally