From 8f6621524bc3e270e2877c4fa4b500bf7d9d98b7 Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Sat, 10 Nov 2018 10:17:08 +0000 Subject: [PATCH] playing hitmarker sound when player is spectating --- .../irresistible/cnr/features/damage_feed.pwn | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gamemodes/irresistible/cnr/features/damage_feed.pwn b/gamemodes/irresistible/cnr/features/damage_feed.pwn index b820593..03a7206 100644 --- a/gamemodes/irresistible/cnr/features/damage_feed.pwn +++ b/gamemodes/irresistible/cnr/features/damage_feed.pwn @@ -236,6 +236,16 @@ public OnPlayerTakenDamage( playerid, issuerid, Float: amount, weaponid, bodypar PlayerPlaySound( issuerid, g_HitmarkerSounds[ soundid ] [ E_SOUND_ID ], 0.0, 0.0, 0.0 ); } + + // play noise for admins + foreach ( new i : Player ) + { + if ( IsPlayerSpectatingPlayer( i, issuerid ) ) + { + new soundid = p_VIPLevel[ i ] ? p_HitmarkerSound{ i } : 0; + PlayerPlaySound( i, g_HitmarkerSounds[ soundid ] [ E_SOUND_ID ], 0.0, 0.0, 0.0 ); + } + } } DamageFeedAddHitTaken( playerid, issuerid, amount, weaponid ); @@ -282,6 +292,11 @@ stock DamageFeedAddHitTaken( playerid, issuerid, Float: amount, weaponid ) AddDamageHit( g_damageTaken[ playerid ], playerid, issuerid, amount, weaponid ); } +stock IsPlayerSpectatingPlayer( playerid, targetid ) +{ + return ( p_Spectating{ playerid } && p_whomSpectating[ playerid ] == targetid && playerid != targetid ); +} + stock UpdateDamageFeed( playerid, bool: modified = false ) { /* ** Core ** */