PHP Code:
#include <sourcemod>
#include <emitsoundany>
public Plugin myinfo =
{
name = "Start/Stop Sound",
author = "Pilo",
description = "",
version = "1.0",
url = "https://forums.alliedmods.net/member.php?u=290157"
};
public void OnPluginStart()
{
RegConsoleCmd("sm_soundstart", Command_Start);
RegConsoleCmd("sm_soundstop", Command_Stop);
}
public void OnMapStart()
{
PrecacheSound("misc/sound.mp3");
AddFileToDownloadsTable("sound/misc/sound.mp3");
}
public Action Command_Start(int client, int args)
{
if (IsClientInGame(client) && !IsFakeClient(client))
{
EmitSoundToAll("misc/sound.mp3");
}
}
public Action Command_Stop(int client, int args)
{
if (IsClientInGame(client) && !IsFakeClient(client))
{
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && !IsFakeClient(i))
{
StopSound(i, -1, "misc/sound.mp3");
}
}
}
}
Enjoy.
__________________