Hook Ham_TraceAttack, get the TR_vecEndPos and use the following code to search for players within a radius.
PHP Code:
#include <engine>
...
#if !defined MAX_PLAYERS
#define MAX_PLAYERS 32
#endif
...
get_players_in_radius(players[MAX_PLAYERS], &num, const Float:origin[3], const Float:radius)
{
// a - Do not include dead players
// h - Do not include HLTV proxies
new _players[MAX_PLAYERS], _num;
get_players(_players, _num, "ah");
num = 0;
for (new i = 0, player, Float:_origin[3]; i < _num; i++)
{
player = _players[i];
entity_get_vector(player, EV_VEC_origin, _origin);
if (vector_distance(origin, _origin) > radius)
continue;
players[num] = player;
num++;
}
}
...
// Usage example
new players[MAX_PLAYERS], num, Float:origin[3];
get_players_in_radius(players, num, origin, 240.0);
__________________