I have the following code (yes, this is for a jailbreak mod), based on
something Exolent posted:
PHP Code:
// Thanks Exolent > https://forums.alliedmods.net/showpost.php?p=760466&postcount=2
#pragma semicolon 1
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
public plugin_init() {
register_plugin("Voice Control", "1.0D", "Elusive");
register_forward(FM_Voice_SetClientListening, "FwdSetClientListening");
}
public FwdSetClientListening(receiver, sender, bool:listen) {
if (!is_user_connected(receiver) || !is_user_connected(sender))
return FMRES_IGNORED;
if (!is_user_admin(sender) && (!is_user_alive(sender) || cs_get_user_team(sender) != CS_TEAM_CT)) {
engfunc(EngFunc_SetClientListening, receiver, sender, false);
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
But for some reason it does not want to work. I wish to block everyone except admins and alive CTs from using voice chat, but everyone should be able to hear those selected groups. As it is, with a two player test neither of us could hear each other - he was a normal player in T, I was an admin in CT. Worse, he gets reliable channel overflows, possibly something to do with SetClientListening being false when he spawns, on the map jail_sanctuary.
I have tried variations, especially one ending with
PHP Code:
engfunc(EngFunc_SetClientListening, receiver, sender, true);
return FMRES_SUPERCEDE;
instead of
PHP Code:
return FMRES_IGNORED;
which seems to work but:
- Why do I have to add that, when Exolent did not (see above for link)
- There are still reliable channel overflows
Any help or explanations would be appreciated.
Thanks.