I guess the only way to do that is to force people to use a custom voicerecord command (+startvoice) and implement at FM_Voice_SetClientListening your own control.
You have to block every voice communication for users not using that command.
PHP Code:
#include <amxmodx>
#include <fakemeta>
#define get_bit(%1,%2) ( %1 & 1 << ( %2 & 31 ) )
#define set_bit(%1,%2) %1 |= ( 1 << ( %2 & 31 ) )
#define clear_bit(%1,%2) %1 &= ~( 1 << ( %2 & 31 ) )
new g_PlayerVoice
public plugin_init()
{
register_clcmd("+startvoice", "player_startvoice_on")
register_clcmd("-startvoice", "player_startvoice_off")
register_forward(FM_Voice_SetClientListenting, "setclient_listening")
}
public player_startvoice_on(id)
{
set_bit(g_PlayerVoice, id)
client_cmd(id, "+voicerecord")
return PLUGIN_HANDLED
}
public player_startvoice_off(id)
{
clear_bit(g_PlayerVoice, id)
client_cmd(id, "-voicerecord")
return PLUGIN_HANDLED
}
public setclient_listening(receiver, sender, bool:listen)
{
if(!is_user_connected(receiver) || !is_user_connected(sender) || (receiver == sender)
return FMRES_IGNORED
if(!get_big(g_PlayerVoice, sender))
{
engfunc(EngFunc_SetClientListening, receiver, sender, false) // Can't talk because is not using +startvoice
return PLUGIN_SUPERCEDE
}
/*
put your code here
you can modify bool:listen depending on what you want and then call SetClientListening + return SUPERCEDE
To change behavior (mute, permit, etc)
engfunc(EngFunc_SetClientListening, receiver, sender, listen)
return FMRES_SUPERCEDE
*/
return FMRES_IGNORED
}
__________________