StopSound: dont disable sound of your own nade

This commit is contained in:
hubdom 2020-12-22 22:00:24 +01:00
parent aebf588588
commit 3992797e93

View File

@ -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];