StopSound: fix awfully obvious bug
This commit is contained in:
		
							parent
							
								
									6fc8146d7f
								
							
						
					
					
						commit
						2c3b0c9233
					
				@ -202,7 +202,7 @@ public Action Command_StopMusic(int client, int args)
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		SetClientCookie(client, g_hCookieStopMapMusic, "1");
 | 
							SetClientCookie(client, g_hCookieStopMapMusic, "1");
 | 
				
			||||||
		CReplyToCommand(client, "%t %t", "Chat Prefix", "Map music disabled");
 | 
							CReplyToCommand(client, "%t %t", "Chat Prefix", "Map music disabled");
 | 
				
			||||||
		StopMapMusic();
 | 
							StopMapMusic(client);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@ -283,7 +283,7 @@ void CheckMapMusicHooks()
 | 
				
			|||||||
	g_bStopMapMusicHooked = bShouldHook;
 | 
						g_bStopMapMusicHooked = bShouldHook;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void StopMapMusic()
 | 
					void StopMapMusic(int client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char sSound[PLATFORM_MAX_PATH];
 | 
						char sSound[PLATFORM_MAX_PATH];
 | 
				
			||||||
	char sEntity[16];
 | 
						char sEntity[16];
 | 
				
			||||||
@ -303,22 +303,11 @@ void StopMapMusic()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		g_MapMusic.GetString(sEntity, sSound, sizeof(sSound));
 | 
							g_MapMusic.GetString(sEntity, sSound, sizeof(sSound));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		StopSoundFromEntity(sSound, entity);
 | 
							Client_StopSound(client, entity, SNDCHAN_STATIC, sSound);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	delete MapMusicSnap;
 | 
						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
 | 
					// I guess this is from SMLib
 | 
				
			||||||
void Client_StopSound(int client, int entity, int channel, const char[] name)
 | 
					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");
 | 
									SetClientCookie(client, g_hCookieStopMapMusic, "1");
 | 
				
			||||||
				CPrintToChat(client, "%t %t", "Chat Prefix", "Map music disabled");
 | 
									CPrintToChat(client, "%t %t", "Chat Prefix", "Map music disabled");
 | 
				
			||||||
				StopMapMusic();
 | 
									StopMapMusic(client);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user