From 3992797e93820ed49b06b0800d90b2ed3855f2ad Mon Sep 17 00:00:00 2001 From: hubdom <26039831+hubdom@users.noreply.github.com> Date: Tue, 22 Dec 2020 22:00:24 +0100 Subject: [PATCH] StopSound: dont disable sound of your own nade --- StopSound/scripting/StopSound.sp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/StopSound/scripting/StopSound.sp b/StopSound/scripting/StopSound.sp index 5d947c24..f6507d5d 100644 --- a/StopSound/scripting/StopSound.sp +++ b/StopSound/scripting/StopSound.sp @@ -518,11 +518,23 @@ public Action Hook_NormalSound_CSS(int clients[MAXPLAYERS], int &numClients, cha return Plugin_Continue; } + int owner = entity; + if(owner > 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; for(int i = 0; i < numClients; i++) { int client = clients[i]; - if(!g_bStopWeaponSounds[client] && IsClientInGame(client)) + if(owner == client || (!g_bStopWeaponSounds[client] && IsClientInGame(client))) { // Keep client. clients[j] = clients[i];