Repository navigation
A3D_GetPlayersInSphere
imshooter edited this page Oct 17, 2026
·
1 revision
Find the players within a distance of a point, nearest first.
Players who are not spawned, are dead or spectate are left out.
native A3D_GetPlayersInSphere(
Float:x,
Float:y,
Float:z,
Float:radius,
players[],
size = sizeof (players),
worldid = -1,
interiorid = -1,
bool:sight = false
);| Parameter | Description | Default |
|---|---|---|
Float:x |
Centre on the X axis. | |
Float:y |
Centre on the Y axis. | |
Float:z |
Centre on the Z axis. | |
Float:radius |
Distance from the centre. | |
players[] |
The players found. | |
size |
Room in players. |
sizeof (players) |
worldid |
Virtual world of the players, or -1 for any. |
-1 |
interiorid |
Interior of the players, or -1 for any. |
-1 |
bool:sight |
Whether the centre must see it, with the map and static objects in the way. | false |
- The number of players written.
A player is measured from their position, the centre of the body about a metre above the feet. Players who are not spawned, are dead or spectate are left out. Players in vehicles are found too, at their own position.
With sight, the line from the centre to the chest of each player must be free of the map and of static objects, in the virtual world asked for.
The players are written nearest first, as many as size allows.
Hurts the players an explosion reaches, but not the ones behind a wall.
stock HurtAround(Float:x, Float:y, Float:z, Float:radius, worldid) {
new
players[MAX_PLAYERS],
count = A3D_GetPlayersInSphere(x, y, z, radius, players, .worldid = worldid, .sight = true),
Float:health
;
for (new i; i != count; ++i) {
GetPlayerHealth(players[i], health);
SetPlayerHealth(players[i], health - 30.0);
}
}- A3D_GetPlayersInCone: Find the players inside a cone, such as the view of a guard or the spread of a shotgun, nearest first.
- A3D_GetVehiclesInSphere: Find the vehicles within a distance of a point, nearest first.
- A3D_GetActorsInSphere: Find the actors within a distance of a point, nearest first.
- A3D_OverlapSphere: Find everything a sphere overlaps.
3DAndreas 0.7.1 · Repository · Releases · MIT License
Guides
- Installation
- Configuration
- Physics objects
- Model settings
- World queries
- The screen
- Routes
- Navigation mesh
- Map database
- Coming from ColAndreas
- Performance
Reference
Functions