Okay, there is an approved plugin called Mic Proximity. I have it on my server but people cut in and out. Why?
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#define PLUGIN "Voice Proximity"
#define VERSION "1.0"
#define AUTHOR "29th ID"
new g_enabled, g_distance
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
g_enabled = register_cvar("amx_voiceprox", "0")
g_distance = register_cvar("amx_voiceprox_distance", "600")
register_forward(FM_PlayerPreThink, "forward_player_prethink")
}
public forward_player_prethink(id) {
if( (get_pcvar_num(g_enabled)) && (is_user_alive(id)) )
check_area(id)
}
public check_area(id) {
new players[32]
new i, pNum
get_players(players, pNum, "a")
for (i=0; i < pNum; i++) {
if(players[i] == id) continue
engfunc(EngFunc_SetClientListening, id, players[i], (entity_distance_stock(id, players[i]) <= get_pcvar_num(g_distance)) ? 1 : 0)
}
}
stock Float:vecdist(Float:vec1[3], Float:vec2[3])
{
new Float:x = vec1[0] - vec2[0]
new Float:y = vec1[1] - vec2[1]
new Float:z = vec1[2] - vec2[2]
x*=x;
y*=y;
z*=z;
return floatsqroot(x+y+z);
}
stock Float:entity_distance_stock(ent1, ent2)
{
new Float:orig1[3]
new Float:orig2[3]
pev(ent1, pev_origin, orig1)
pev(ent2, pev_origin, orig2)
return vecdist(orig1, orig2)
}