[CS:GO] Restrict Commands

Someone

Участник
Сообщения
1,933
Реакции
1,653
Вообщем хотел поставить Restrict Commands (https://forums.alliedmods.net/showthread.php?t=275898) и добавить в него свои звуки, но как я понял с ним этого не получится.

Вот его код
// Plugin definitions
#define PLUGIN_VERSION "1.0.0"
#pragma semicolon 1
#include <sourcemod>

new String:sound[65];
int num;
Handle g_enabled = INVALID_HANDLE;

new bool:g_LoggedFileName = false; /* Whether or not the file name has been logged */
new g_ErrorCount = 0; /* Current error count */
new g_CurrentLine = 0; /* Current line we're on */
new String:g_Filename[PLATFORM_MAX_PATH]; /* Used for error messages */

public Plugin:myinfo =
{
name = "[CS:GO]Restricted Commands",
author = "Gdk",
version = PLUGIN_VERSION,
description = "Plays a negative sound when players type a restricted command",
url = "https://topsecretgaming.net"
};

public OnPluginStart()
{
ReadCommands();
g_enabled = CreateConVar("sm_restriced_commands_enabled", "1", "Whether plugin is enabled");
AutoExecConfig(true, "restricted_commands", "sourcemod");
}

public ReadCommands()
{
BuildPath(Path_SM, g_Filename, sizeof(g_Filename), "configs/restricted_commands.ini");

File file = OpenFile(g_Filename, "rt");
if (!file)
{
ParseError("Could not open file!");
return;
}

while (!file.EndOfFile())
{
char line[255];
if (!file.ReadLine(line, sizeof(line)))
break;

/* Trim comments */
int len = strlen(line);
bool ignoring = false;
for (int i=0; i<len; i++)
{
if (ignoring)
{
if (line == '"')
ignoring = false;
} else {
if (line == '"')
{
ignoring = true;
} else if (line == ';') {
line = '\0';
break;
} else if (line == '/'
&& i != len - 1
&& line[i+1] == '/')
{
line = '\0';
break;
}
}
}

TrimString(line);

if ((line[0] == '/' && line[1] == '/')
|| (line[0] == ';' || line[0] == '\0'))
{
continue;
}

RegCommands(line);
}

file.Close();
}

ParseError(const String:format[], any:...)
{
decl String:buffer[512];

if (!g_LoggedFileName)
{
LogError("Error(s) detected parsing %s", g_Filename);
g_LoggedFileName = true;
}

VFormat(buffer, sizeof(buffer), format, 2);

LogError(" (line %d) %s", g_CurrentLine, buffer);

g_ErrorCount++;
}

RegCommands(const String:line[])
{
RegConsoleCmd(line, Command_PlaySound);
}

public Action Command_PlaySound(int client, int args)
{
if (GetConVarInt(g_enabled) == 1)
{
num = GetRandomInt(1, 112);
getSound(num);
ClientCommand(client, sound);
}
return Plugin_Handled;
}

public getSound(int randNum)
{
if(num == 1)
sound = "playgamesound player/vo/balkan/negative01.wav";
if(num == 2)
sound = "playgamesound player/vo/balkan/negative02.wav";
if(num == 3)
sound = "playgamesound player/vo/balkan/negative04.wav";
if(num == 4)
sound = "playgamesound player/vo/balkan/negative03.wav";
if(num == 5)
sound = "playgamesound player/vo/fbihrt/radiobotreponsenegative08.wav";
if(num == 6)
sound = "playgamesound player/vo/fbihrt/radiobotreponsenegative10.wav";
if(num == 7)
sound = "playgamesound player/vo/fbihrt/radiobotreponsenegative12.wav";
if(num == 8)
sound = "playgamesound player/vo/fbihrt/radiobotreponsenegative11.wav";
if(num == 9)
sound = "playgamesound player/vo/fbihrt/radiobotreponsenegative06.wav";
if(num == 10)
sound = "playgamesound player/vo/fbihrt/radiobotreponsenegative09.wav";
if(num == 11)
sound = "playgamesound player/vo/fbihrt/radiobotreponsenegative03.wav";
if(num == 12)
sound = "playgamesound player/vo/fbihrt/radiobotreponsenegative07.wav";
if(num == 13)
sound = "playgamesound player/vo/fbihrt/radiobotreponsenegative04.wav";
if(num == 14)
sound = "playgamesound player/vo/fbihrt/radiobotreponsenegative01.wav";
if(num == 15)
sound = "playgamesound player/vo/fbihrt/radiobotreponsenegative05.wav";
if(num == 16)
sound = "playgamesound player/vo/gsg9/negative01.wav";
if(num == 17)
sound = "playgamesound player/vo/gsg9/disagree04.wav";
if(num == 18)
sound = "playgamesound player/vo/gsg9/negative02.wav";
if(num == 19)
sound = "playgamesound player/vo/gsg9/disagree01.wav";
if(num == 20)
sound = "playgamesound player/vo/gsg9/disagree02.wav";
if(num == 21)
sound = "playgamesound player/vo/gsg9/negative04.wav";
if(num == 22)
sound = "playgamesound player/vo/gsg9/negative03.wav";
if(num == 23)
sound = "playgamesound player/vo/sas/negative01.wav";
if(num == 24)
sound = "playgamesound player/vo/sas/negative05.wav";
if(num == 25)
sound = "playgamesound player/vo/sas/negative02.wav";
if(num == 26)
sound = "playgamesound player/vo/sas/disagree01.wav";
if(num == 27)
sound = "playgamesound player/vo/sas/disagree02.wav";
if(num == 28)
sound = "playgamesound player/vo/sas/negative06.wav";
if(num == 29)
sound = "playgamesound player/vo/sas/negative04.wav";
if(num == 30)
sound = "playgamesound player/vo/sas/negative03.wav";
if(num == 31)
sound = "playgamesound player/vo/pirate/negativeno05.wav";
if(num == 32)
sound = "playgamesound player/vo/pirate/negativeno04.wav";
if(num == 33)
sound = "playgamesound player/vo/pirate/negative01.wav";
if(num == 34)
sound = "playgamesound player/vo/pirate/disagree03.wav";
if(num == 35)
sound = "playgamesound player/vo/pirate/disagree04.wav";
if(num == 36)
sound = "playgamesound player/vo/pirate/negative02.wav";
if(num == 37)
sound = "playgamesound player/vo/pirate/disagree01.wav";
if(num == 38)
sound = "playgamesound player/vo/pirate/disagree02.wav";
if(num == 39)
sound = "playgamesound player/vo/pirate/negative04.wav";
if(num == 40)
sound = "playgamesound player/vo/pirate/negative03.wav";
if(num == 41)
sound = "playgamesound player/vo/gign/disagree06.wav";
if(num == 42)
sound = "playgamesound player/vo/gign/negative01.wav";
if(num == 43)
sound = "playgamesound player/vo/gign/negative05.wav";
if(num == 44)
sound = "playgamesound player/vo/gign/disagree03.wav";
if(num == 45)
sound = "playgamesound player/vo/gign/negative02.wav";
if(num == 46)
sound = "playgamesound player/vo/gign/disagree01.wav";
if(num == 47)
sound = "playgamesound player/vo/gign/disagree02.wav";
if(num == 48)
sound = "playgamesound player/vo/gign/disagree05.wav";
if(num == 49)
sound = "playgamesound player/vo/gign/negative04.wav";
if(num == 50)
sound = "playgamesound player/vo/gign/negative03.wav";
if(num == 51)
sound = "playgamesound player/vo/gign/disagree07.wav";
if(num == 52)
sound = "playgamesound player/vo/gign/disagree10.wav";
if(num == 53)
sound = "playgamesound player/vo/anarchist/negativeno05.wav";
if(num == 54)
sound = "playgamesound player/vo/anarchist/negativeno04.wav";
if(num == 55)
sound = "playgamesound player/vo/anarchist/negative01.wav";
if(num == 56)
sound = "playgamesound player/vo/anarchist/negative02.wav";
if(num == 57)
sound = "playgamesound player/vo/anarchist/negative04.wav";
if(num == 58)
sound = "playgamesound player/vo/anarchist/negative03.wav";
if(num == 59)
sound = "playgamesound player/vo/professional/radiobotreponsenegative08.wav";
if(num == 60)
sound = "playgamesound player/vo/professional/radiobotreponsenegative10.wav";
if(num == 61)
sound = "playgamesound player/vo/professional/radiobotreponsenegative19.wav";
if(num == 62)
sound = "playgamesound player/vo/professional/radiobotreponsenegative14.wav";
if(num == 63)
sound = "playgamesound player/vo/professional/radiobotreponsenegative12.wav";
if(num == 64)
sound = "playgamesound player/vo/professional/radiobotreponsenegative06.wav";
if(num == 65)
sound = "playgamesound player/vo/professional/radiobotreponsenegative09.wav";
if(num == 66)
sound = "playgamesound player/vo/professional/radiobotreponsenegative03.wav";
if(num == 67)
sound = "playgamesound player/vo/professional/radiobotreponsenegative07.wav";
if(num == 68)
sound = "playgamesound player/vo/professional/radiobotreponsenegative01.wav";
if(num == 69)
sound = "playgamesound player/vo/professional/radiobotreponsenegative02.wav";
if(num == 70)
sound = "playgamesound player/vo/professional/radiobotreponsenegative05.wav";
if(num == 71)
sound = "playgamesound player/vo/professional/radiobotreponsenegative16.wav";
if(num == 72)
sound = "playgamesound player/vo/separatist/negative01.wav";
if(num == 73)
sound = "playgamesound player/vo/separatist/disagree04.wav";
if(num == 74)
sound = "playgamesound player/vo/separatist/negative02.wav";
if(num == 75)
sound = "playgamesound player/vo/separatist/negative04.wav";
if(num == 76)
sound = "playgamesound player/vo/separatist/negative03.wav";
if(num == 77)
sound = "playgamesound player/vo/leet/negativeno04.wav";
if(num == 78)
sound = "playgamesound player/vo/leet/negative01.wav";
if(num == 79)
sound = "playgamesound player/vo/leet/negativeno03.wav";
if(num == 80)
sound = "playgamesound player/vo/leet/negative02.wav";
if(num == 81)
sound = "playgamesound player/vo/leet/disagree01.wav";
if(num == 82)
sound = "playgamesound player/vo/leet/negative04.wav";
if(num == 83)
sound = "playgamesound player/vo/leet/negative03.wav";
if(num == 84)
sound = "playgamesound player/vo/idf/negative01.wav";
if(num == 85)
sound = "playgamesound player/vo/idf/disagree03.wav";
if(num == 86)
sound = "playgamesound player/vo/idf/negative02.wav";
if(num == 87)
sound = "playgamesound player/vo/idf/disagree01.wav";
if(num == 88)
sound = "playgamesound player/vo/idf/disagree02.wav";
if(num == 89)
sound = "playgamesound player/vo/swat/radiobotreponsenegative08.wav";
if(num == 90)
sound = "playgamesound player/vo/swat/radiobotreponsenegative10.wav";
if(num == 91)
sound = "playgamesound player/vo/swat/radiobotreponsenegative06.wav";
if(num == 92)
sound = "playgamesound player/vo/swat/radiobotreponsenegative09.wav";
if(num == 93)
sound = "playgamesound player/vo/swat/radiobotreponsenegative03.wav";
if(num == 94)
sound = "playgamesound player/vo/swat/radiobotreponsenegative07.wav";
if(num == 95)
sound = "playgamesound player/vo/swat/radiobotreponsenegative01.wav";
if(num == 96)
sound = "playgamesound player/vo/swat/radiobotreponsenegative02.wav";
if(num == 97)
sound = "playgamesound player/vo/swat/radiobotreponsenegative05.wav";
if(num == 98)
sound = "playgamesound player/vo/seal/negative01.wav";
if(num == 99)
sound = "playgamesound player/vo/seal/disagree03.wav";
if(num == 100)
sound = "playgamesound player/vo/seal/disagree04.wav";
if(num == 101)
sound = "playgamesound player/vo/seal/negative02.wav";
if(num == 102)
sound = "playgamesound player/vo/seal/disagree01.wav";
if(num == 103)
sound = "playgamesound player/vo/seal/disagree02.wav";
if(num == 104)
sound = "playgamesound player/vo/seal/disagree05.wav";
if(num == 105)
sound = "playgamesound player/vo/seal/negative04.wav";
if(num == 106)
sound = "playgamesound player/vo/seal/negative03.wav";
if(num == 107)
sound = "playgamesound player/vo/phoenix/negativeno05.wav";
if(num == 108)
sound = "playgamesound player/vo/phoenix/negative01.wav";
if(num == 109)
sound = "playgamesound player/vo/phoenix/negative02.wav";
if(num == 110)
sound = "playgamesound player/vo/phoenix/disagree01.wav";
if(num == 111)
sound = "playgamesound player/vo/phoenix/negative04.wav";
if(num == 112)
sound = "playgamesound player/vo/phoenix/negative03.wav";
}

Попытался совместить его с рабочим testsound'ом
#include <sourcemod>
#include <sdktools>

new const String:FULL_SOUND_PATH[] = "sound/testsound/test3.mp3";
new const String:RELATIVE_SOUND_PATH[] = "*testsound/test3.mp3";

public OnPluginStart()
{
RegConsoleCmd( "sm_testsound", sm_testsound );
}

public OnMapStart()
{
AddFileToDownloadsTable( FULL_SOUND_PATH );
FakePrecacheSound( RELATIVE_SOUND_PATH );
}

public Action:sm_testsound( client, argc )
{
EmitSoundToClient( client, RELATIVE_SOUND_PATH );

return Plugin_Handled;
}

stock FakePrecacheSound( const String:szPath[] )
{
AddToStringTable( FindStringTable( "soundprecache" ), szPath );
}

Вот что получилось
// Plugin definitions
#define PLUGIN_VERSION "1.0.0"
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>

new String:sound[65];
int num;
Handle g_enabled = INVALID_HANDLE;

new const String:FULL_SOUND_PATH[] = "sound/testsound/test3.mp3";
new const String:RELATIVE_SOUND_PATH[] = "*testsound/test3.mp3";

new bool:g_LoggedFileName = false; /* Whether or not the file name has been logged */
new g_ErrorCount = 0; /* Current error count */
new g_CurrentLine = 0; /* Current line we're on */
new String:g_Filename[PLATFORM_MAX_PATH]; /* Used for error messages */

public Plugin:myinfo =
{
name = "[CS:GO]Restricted Commands",
author = "Gdk",
version = PLUGIN_VERSION,
description = "Plays a negative sound when players type a restricted command",
url = "https://topsecretgaming.net"
};

public OnPluginStart()
{
ReadCommands();
g_enabled = CreateConVar("sm_restriced_commands_enabled", "1", "Whether plugin is enabled");
AutoExecConfig(true, "restricted_commands", "sourcemod");
}

public OnMapStart()
{
AddFileToDownloadsTable( FULL_SOUND_PATH );
FakePrecacheSound( RELATIVE_SOUND_PATH );
}

public ReadCommands()
{
BuildPath(Path_SM, g_Filename, sizeof(g_Filename), "configs/restricted_commands.ini");

File file = OpenFile(g_Filename, "rt");
if (!file)
{
ParseError("Could not open file!");
return;
}

while (!file.EndOfFile())
{
char line[255];
if (!file.ReadLine(line, sizeof(line)))
break;

/* Trim comments */
int len = strlen(line);
bool ignoring = false;
for (int i=0; i<len; i++)
{
if (ignoring)
{
if (line == '"')
ignoring = false;
} else {
if (line == '"')
{
ignoring = true;
} else if (line == ';') {
line = '\0';
break;
} else if (line == '/'
&& i != len - 1
&& line[i+1] == '/')
{
line = '\0';
break;
}
}
}

TrimString(line);

if ((line[0] == '/' && line[1] == '/')
|| (line[0] == ';' || line[0] == '\0'))
{
continue;
}

RegCommands(line);
}

file.Close();
}

ParseError(const String:format[], any:...)
{
decl String:buffer[512];

if (!g_LoggedFileName)
{
LogError("Error(s) detected parsing %s", g_Filename);
g_LoggedFileName = true;
}

VFormat(buffer, sizeof(buffer), format, 2);

LogError(" (line %d) %s", g_CurrentLine, buffer);

g_ErrorCount++;
}

RegCommands(const String:line[])
{
RegConsoleCmd(line, Command_PlaySound);
}

public Action Command_PlaySound(int client, int args)
{
if (GetConVarInt(g_enabled) == 1)
{
num = GetRandomInt(1, 2);
getSound(num);
ClientCommand(client, sound);
}
return Plugin_Handled;
}

public getSound(int randNum)
{
if(num == 1)
EmitSoundToClient( client, RELATIVE_SOUND_PATH );
if(num == 2)
EmitSoundToClient( client, RELATIVE_SOUND_PATH );
}

stock FakePrecacheSound( const String:szPath[] )
{
AddToStringTable( FindStringTable( "soundprecache" ), szPath );
}


Так-как я совсем в этом не смыслю, нифига у меня не получилось. При компиляции ругается на EmitSoundToClient - undefined symbol "client"

Как сделать, чтобы заработало?
 

AlmazON

Не путать с самим yand3xmail
Сообщения
5,099
Реакции
2,755
добавить в него свои звуки
if(num == 112)
sound = "playgamesound player/vo/phoenix/negative03.wav";
Берёшь и продолжаешь цепочку, Оффтоп прописывая цифру 113 и по порядку, а в кавычках - путь к новому звуку.
Здесь меняешь на тот максимум звуков, что сам вписал.
Будет работать лишь для стандартных звуков.
 

Someone

Участник
Сообщения
1,933
Реакции
1,653
Берёшь и продолжаешь цепочку, Оффтоп прописывая цифру 113 и по порядку, а в кавычках - путь к новому звуку.Здесь меняешь на тот максимум звуков, что сам вписал.
Будет работать лишь для стандартных звуков.

Ну вот, а мне бы свой звук добавить.
 

Andy Freeman

Fatal error
Сообщения
400
Реакции
91
Ну в итоге вот это: [Sound] S_StartSound(): Failed to load sound 'joinsound\test3.mp3'. Can't create mixer.
Звуки которые обрезаны методом сайта работать в ксго не будут про это уже писали в темах roundendsound нужно только программой обрезать чтобы они заработали. Вот тема https://forums.alliedmods.net/showpost.php?p=2261973&postcount=50
 

AlmazON

Не путать с самим yand3xmail
Сообщения
5,099
Реакции
2,755
Славьте CS:GO с её багами... Нужно всё прописать в исходник (самое простое) и наверняка заработает:
C-подобный:
public OnMapStart() 
{ 
 [B]AddFileToDownloadsTable("Здесь_полный_путь_к_звуку"); [/B]
 [U]FakePrecacheSound( RELATIVE_SOUND_PATH );[/U]
}
Это, как полный пример для одного звука. Подчёркнутое - вырезать.
 

Someone

Участник
Сообщения
1,933
Реакции
1,653
Славьте CS:GO с её багами... Нужно всё прописать в исходник (самое простое) и наверняка заработает:Это, как полный пример для одного звука. Подчёркнутое - вырезать.

Так говорю же, он не компилируется. а testsound работает отлично у всех игроков.
 

AlmazON

Не путать с самим yand3xmail
Сообщения
5,099
Реакции
2,755
Так говорю же, он не компилируется
PHP:
// Plugin definitions
#define PLUGIN_VERSION "1.0.0"
#pragma semicolon 1
#include <sourcemod>
#include <sdktools_stringtables>

new String:sSound[][] =
{
	"*/Путь к звуку 1",
	"*/Путь к звуку 2"
};

#define SOUNDS sizeof(sSound)-1

Handle g_enabled = INVALID_HANDLE;

new bool:g_LoggedFileName = false;			/* Whether or not the file name has been logged */
new g_ErrorCount = 0;						/* Current error count */
new g_CurrentLine = 0;						/* Current line we're on */
new String:g_Filename[PLATFORM_MAX_PATH];	/* Used for error messages */

public Plugin:myinfo =
{
	name = "[CS:GO]Restricted Commands",
	author = "Gdk",
	version = PLUGIN_VERSION,
	description = "Plays a negative sound when players type a restricted command",
	url = "https://topsecretgaming.net"
};

public OnPluginStart()
{
	ReadCommands();
	g_enabled = CreateConVar("sm_restriced_commands_enabled", "1", "Whether plugin is enabled");
	AutoExecConfig(true, "restricted_commands", "sourcemod");
}

public OnMapStart()
{
	for (new i; i <= SOUNDS; ++i)
	{
		FormatEx(g_Filename, PLATFORM_MAX_PATH, "sound/%s", sSound[i][2]);
		AddFileToDownloadsTable(g_Filename);
	}
}

public ReadCommands()
{
	BuildPath(Path_SM, g_Filename, sizeof(g_Filename), "configs/restricted_commands.ini");
	
	File file = OpenFile(g_Filename, "rt");
	if (!file)
	{
		ParseError("Could not open file!");
		return;
	}
	
	while (!file.EndOfFile())
	{
		char line[255];
		if (!file.ReadLine(line, sizeof(line)))
			break;
		
		/* Trim comments */
		int len = strlen(line);
		bool ignoring = false;
		for (int i=0; i<len; i++)
		{
			if (ignoring)
			{
				if (line[i] == '"')
					ignoring = false;
			} else {
				if (line[i] == '"')
				{
					ignoring = true;
				} else if (line[i] == ';') {
					line[i] = '\0';
					break;
				} else if (line[i] == '/'
							&& i != len - 1
							&& line[i+1] == '/')
				{
					line[i] = '\0';
					break;
				}
			}
		}
		
		TrimString(line);
		
		if ((line[0] == '/' && line[1] == '/')
			|| (line[0] == ';' || line[0] == '\0'))
		{
			continue;
		}
	
		RegCommands(line);
	}
	
	file.Close();
}

ParseError(const String:format[], any:...)
{
	decl String:buffer[512];
	
	if (!g_LoggedFileName)
	{
		LogError("Error(s) detected parsing %s", g_Filename);
		g_LoggedFileName = true;
	}
	
	VFormat(buffer, sizeof(buffer), format, 2);
	
	LogError(" (line %d) %s", g_CurrentLine, buffer);
	
	g_ErrorCount++;
}

RegCommands(const String:line[])
{
	RegConsoleCmd(line, Command_PlaySound);
}

public Action Command_PlaySound(int client, int args) 
{
	if (GetConVarInt(g_enabled) == 1)
	{
		ClientCommand(client, "play \"%s\"", sSound[GetRandomInt(0, SOUNDS)]);
	}
	return Plugin_Handled;
}
sSound - колонка звуков. Вписывать через запятую, в кавычках - путь к звуку без папки sound, но в самом начале дописывать */. Оффтоп
 

DarklSide

Участник
Сообщения
931
Реакции
468
Звуки которые обрезаны методом сайта работать в ксго не будут про это уже писали в темах roundendsound нужно только программой обрезать чтобы они заработали. Вот тема https://forums.alliedmods.net/showpost.php?p=2261973&postcount=50

Инфа неверная, давно сделал видео, только её тема - стандартного использования EmitSoundToClient в csgo: http://hlmod.ru/forum/showpost.php?p=205567&postcount=41.
Использовал звуки конвертированные с сайта: https://online-audio-converter.com/ru/ в стандартное качество (по его меркам), из 320kbps.

Так же советую вырезать обложку если она существует, и теги если их не используем, например ext: https://forums.alliedmods.net/showthread.php?t=105816.
Легче этим делать - tagscanner.
 

Someone

Участник
Сообщения
1,933
Реакции
1,653
PHP:
// Plugin definitions
#define PLUGIN_VERSION "1.0.0"
#pragma semicolon 1
#include <sourcemod>
#include <sdktools_stringtables>

new String:sSound[][] =
{
	"*/Путь к звуку 1",
	"*/Путь к звуку 2"
};

#define SOUNDS sizeof(sSound)-1

Handle g_enabled = INVALID_HANDLE;

new bool:g_LoggedFileName = false;			/* Whether or not the file name has been logged */
new g_ErrorCount = 0;						/* Current error count */
new g_CurrentLine = 0;						/* Current line we're on */
new String:g_Filename[PLATFORM_MAX_PATH];	/* Used for error messages */

public Plugin:myinfo =
{
	name = "[CS:GO]Restricted Commands",
	author = "Gdk",
	version = PLUGIN_VERSION,
	description = "Plays a negative sound when players type a restricted command",
	url = "https://topsecretgaming.net"
};

public OnPluginStart()
{
	ReadCommands();
	g_enabled = CreateConVar("sm_restriced_commands_enabled", "1", "Whether plugin is enabled");
	AutoExecConfig(true, "restricted_commands", "sourcemod");
}

public OnMapStart()
{
	for (new i; i <= SOUNDS; ++i)
	{
		FormatEx(g_Filename, PLATFORM_MAX_PATH, "sound/%s", sSound[i][2]);
		AddFileToDownloadsTable(g_Filename);
	}
}

public ReadCommands()
{
	BuildPath(Path_SM, g_Filename, sizeof(g_Filename), "configs/restricted_commands.ini");
	
	File file = OpenFile(g_Filename, "rt");
	if (!file)
	{
		ParseError("Could not open file!");
		return;
	}
	
	while (!file.EndOfFile())
	{
		char line[255];
		if (!file.ReadLine(line, sizeof(line)))
			break;
		
		/* Trim comments */
		int len = strlen(line);
		bool ignoring = false;
		for (int i=0; i<len; i++)
		{
			if (ignoring)
			{
				if (line[i] == '"')
					ignoring = false;
			} else {
				if (line[i] == '"')
				{
					ignoring = true;
				} else if (line[i] == ';') {
					line[i] = '\0';
					break;
				} else if (line[i] == '/'
							&& i != len - 1
							&& line[i+1] == '/')
				{
					line[i] = '\0';
					break;
				}
			}
		}
		
		TrimString(line);
		
		if ((line[0] == '/' && line[1] == '/')
			|| (line[0] == ';' || line[0] == '\0'))
		{
			continue;
		}
	
		RegCommands(line);
	}
	
	file.Close();
}

ParseError(const String:format[], any:...)
{
	decl String:buffer[512];
	
	if (!g_LoggedFileName)
	{
		LogError("Error(s) detected parsing %s", g_Filename);
		g_LoggedFileName = true;
	}
	
	VFormat(buffer, sizeof(buffer), format, 2);
	
	LogError(" (line %d) %s", g_CurrentLine, buffer);
	
	g_ErrorCount++;
}

RegCommands(const String:line[])
{
	RegConsoleCmd(line, Command_PlaySound);
}

public Action Command_PlaySound(int client, int args) 
{
	if (GetConVarInt(g_enabled) == 1)
	{
		ClientCommand(client, "play \"%s\"", sSound[GetRandomInt(0, SOUNDS)]);
	}
	return Plugin_Handled;
}
sSound - колонка звуков. Вписывать через запятую, в кавычках - путь к звуку без папки sound, но в самом начале дописывать */. Оффтоп

Во, спасибо, работает.

Но вот как сделать, чтобы звук проигрывался тем у кого нет доступа к команде?

На аллиде писали это:
while (ReadCommandIterator(CmdIter, Name, sizeof(Name), Flags, Desc, sizeof(Desc)))
{
if ((StrContains(Name, arg, false) != -1) && CheckCommandAccess(client, Name, Flags))
{
PrintToConsole(client, "[%03d] %s - %s", i++, Name, (Desc[0] == '\0') ? NoDesc : Desc);
}
}
Ну а как это сюда вписать?
 
Сверху Снизу