This extension allow you to control who can use the voice aka mic in the server.
Install:
Upload the addons folder to your mods root directory.
Natives:
Code:
#define SPEAK_NORMAL 0
#define SPEAK_MUTED 1
#define SPEAK_ALL 2
#define SPEAK_LISTENALL 4
/**
* Set the client listening flags.
*
* @param client Player index
* @param iSpeakFlags The speak flag mode. Use the SPEAK_* defines
* @noreturn
*/
native SetClientListeningFlags(client, iSpeakFlags);
/**
* Retrieve the client current listening flags.
*
* @param client Player index
* @return The speak flags.
*/
native GetClientListeningFlags(client);
/**
* Set the receiver ability to listen to the sender.
*
* @param iReceiver The listener index.
* @param iSender The sender index.
* @return True if sucessful otherwise false.
*/
native bool:SetClientListening(iReceiver, iSender, bool:bListen);
/**
* Retrieves of the receiver can listen to the sender.
*
* @param iReceiver The listener index.
* @param iSender The sender index.
* @return True if sucessful otherwise false.
*/
native bool:GetClientListening(iReceiver, iSender);
Example:
Code:
#include <sourcemod>
#include <voicemanagement>
public OnPluginStart()
{
RegConsoleCmd("mute", CmdRun);
}
public Action:CmdRun(client, args)
{
if(client)
{
SetClientListeningFlags(client, SPEAK_MUTED);
PrintToConsole(client, "You have muted yourself");
} else {
PrintToServer("You must be in game to use this option");
}
return Plugin_Handled;
}
Credit:
- ^BuGs^ - For helping me test it.
AMX Mod X - base on the set/get_speak
Source Code
Click here to download
__________________