StopSound: fix awfully obvious bug

This commit is contained in:
BotoX 2017-10-17 23:38:55 +02:00
parent 6fc8146d7f
commit 2c3b0c9233

View File

@ -202,7 +202,7 @@ public Action Command_StopMusic(int client, int args)
{
SetClientCookie(client, g_hCookieStopMapMusic, "1");
CReplyToCommand(client, "%t %t", "Chat Prefix", "Map music disabled");
StopMapMusic();
StopMapMusic(client);
}
else
{
@ -283,7 +283,7 @@ void CheckMapMusicHooks()
g_bStopMapMusicHooked = bShouldHook;
}
void StopMapMusic()
void StopMapMusic(int client)
{
char sSound[PLATFORM_MAX_PATH];
char sEntity[16];
@ -303,22 +303,11 @@ void StopMapMusic()
g_MapMusic.GetString(sEntity, sSound, sizeof(sSound));
StopSoundFromEntity(sSound, entity);
Client_StopSound(client, entity, SNDCHAN_STATIC, sSound);
}
delete MapMusicSnap;
}
void StopSoundFromEntity(const char[] sSample, int entity)
{
for(int i = 1; i <= MaxClients; i++)
{
if(g_bStopMapMusic[i] && IsClientInGame(i))
{
Client_StopSound(i, entity, SNDCHAN_STATIC, sSample);
}
}
}
// I guess this is from SMLib
void Client_StopSound(int client, int entity, int channel, const char[] name)
{
@ -389,7 +378,7 @@ public int MenuHandler_StopSoundsSettings(Menu menu, MenuAction action, int clie
{
SetClientCookie(client, g_hCookieStopMapMusic, "1");
CPrintToChat(client, "%t %t", "Chat Prefix", "Map music disabled");
StopMapMusic();
StopMapMusic(client);
}
else
{