From 7d0d72260bcd316635f801787643a863af00ba94 Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Sat, 13 Oct 2018 17:04:32 +0100 Subject: [PATCH] global object replacement --- gamemodes/irresistible/cnr/features/damage_feed.pwn | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/damage_feed.pwn b/gamemodes/irresistible/cnr/features/damage_feed.pwn index 2ab6629..25e1a7e 100644 --- a/gamemodes/irresistible/cnr/features/damage_feed.pwn +++ b/gamemodes/irresistible/cnr/features/damage_feed.pwn @@ -47,6 +47,7 @@ static stock bool: p_GotHit [ MAX_PLAYERS char ], bool: p_SyncingPlayer [ MAX_PLAYERS char ], + p_DamageObject [ MAX_PLAYERS ] = { -1, ... }, PlayerText: g_damageFeedTakenTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... }, PlayerText: g_damageFeedGivenTD [ MAX_PLAYERS ] = { PlayerText: INVALID_TEXT_DRAW, ... }, @@ -163,7 +164,10 @@ public OnPlayerTakenDamage( playerid, issuerid, Float: amount, weaponid, bodypar if ( GetPlayerArmour( playerid, armour ) ) { - SetPlayerAttachedObject( playerid, 4, armour - amount <= 0.0 ? ( 1240 ) : ( 1242 ), 1, 1.400000, -0.004999, 0.034999, 4.499999, 83.500030, -3.799998, 1.000000, 1.000000, 1.026999 ); + p_DamageObject[ playerid ] = CreateObject( armour - amount <= 0.0 ? ( 1240 ) : ( 1242 ), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 100.0 ); + AttachObjectToPlayer( p_DamageObject[ playerid ], playerid, 0.0, 0.0, 1.5, 0.0, 0.0, 0.0 ); + + //SetPlayerAttachedObject( playerid, 4, armour - amount <= 0.0 ? ( 1240 ) : ( 1242 ), 1, 1.400000, -0.004999, 0.034999, 4.499999, 83.500030, -3.799998, 1.000000, 1.000000, 1.026999 ); SetTimerEx( "HideDamageObject", 1000, false, "d", playerid ); Streamer_Update( playerid, STREAMER_TYPE_OBJECT ); @@ -190,8 +194,8 @@ public OnPlayerTakenDamage( playerid, issuerid, Float: amount, weaponid, bodypar function HideDamageObject( playerid ) { - if( IsPlayerAttachedObjectSlotUsed( playerid, 4 ) ) - RemovePlayerAttachedObject( playerid, 4 ); + if( IsValidObject( p_DamageObject[ playerid ] ) ) + DestroyObject( p_DamageObject[ playerid ] ); p_GotHit{ playerid } = false; return 1;