[StopSound] Owner check for CSGO and minor corrections.
This commit is contained in:
parent
567921451a
commit
669d29f119
@ -442,7 +442,7 @@ void ShowStopSoundsSettingsMenu(int client)
|
|||||||
menu.AddItem("1", sBuffer);
|
menu.AddItem("1", sBuffer);
|
||||||
|
|
||||||
Format(sBuffer, sizeof(sBuffer), "%T%T", "Map Ambient", client, g_bStopMapAmbient[client] ? "Disabled" : "Enabled", client);
|
Format(sBuffer, sizeof(sBuffer), "%T%T", "Map Ambient", client, g_bStopMapAmbient[client] ? "Disabled" : "Enabled", client);
|
||||||
menu.AddItem("1", sBuffer);
|
menu.AddItem("2", sBuffer);
|
||||||
|
|
||||||
menu.ExitBackButton = true;
|
menu.ExitBackButton = true;
|
||||||
menu.Display(client, MENU_TIME_FOREVER);
|
menu.Display(client, MENU_TIME_FOREVER);
|
||||||
@ -630,7 +630,7 @@ public Action Hook_NormalSound_CSS(int clients[MAXPLAYERS], int &numClients, cha
|
|||||||
for(int i = 0; i < numClients; i++)
|
for(int i = 0; i < numClients; i++)
|
||||||
{
|
{
|
||||||
int client = clients[i];
|
int client = clients[i];
|
||||||
if(owner == client || (!g_bStopWeaponSounds[client]))
|
if(owner == client || !g_bStopWeaponSounds[client])
|
||||||
{
|
{
|
||||||
// Keep client.
|
// Keep client.
|
||||||
clients[j] = clients[i];
|
clients[j] = clients[i];
|
||||||
@ -658,11 +658,23 @@ public Action Hook_NormalSound_CSGO(int clients[MAXPLAYERS], int &numClients, ch
|
|||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int owner = -1;
|
||||||
|
if(entity > MaxClients)
|
||||||
|
{
|
||||||
|
char sClassname[64];
|
||||||
|
if(GetEntityClassname(entity, sClassname, sizeof(sClassname)))
|
||||||
|
{
|
||||||
|
int projectile = StrContains(sClassname, "_projectile");
|
||||||
|
if(projectile > 0 && projectile == strlen(sClassname) - strlen("_projectile")) // endswith
|
||||||
|
owner = GetEntPropEnt(entity, Prop_Send, "m_hThrower");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for(int i = 0; i < numClients; i++)
|
for(int i = 0; i < numClients; i++)
|
||||||
{
|
{
|
||||||
int client = clients[i];
|
int client = clients[i];
|
||||||
if(!g_bStopWeaponSounds[client] && IsClientInGame(client))
|
if(owner == client || !g_bStopWeaponSounds[client])
|
||||||
{
|
{
|
||||||
// Keep client.
|
// Keep client.
|
||||||
clients[j] = clients[i];
|
clients[j] = clients[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user