Skip to content

A3D_GetVehiclesOnScreen

imshooter edited this page Oct 17, 2026 · 1 revision

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.

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

Parameters

Parameter Description Default
playerid Player whose screen it is.
vehicles[] The vehicles found.
size Room in vehicles. sizeof (vehicles)
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 vehicles written.

Remarks

A vehicle shows when its centre lies on the screen, within range of the camera, in the same virtual world and interior. The vehicle the viewer is in is left out. With sight, vehicles behind the map or a static object are left out too.

Example

stock CountVehiclesInView(playerid) {
    new vehicles[64];

    return A3D_GetVehiclesOnScreen(playerid, vehicles, .sight = true, .range = 100.0);
}

Related

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