destroy damage object if it exists

This commit is contained in:
Lorenc Pekaj 2018-10-14 13:38:34 +11:00
parent cd86fd9ee5
commit 9ed5221550

View File

@ -164,13 +164,15 @@ public OnPlayerTakenDamage( playerid, issuerid, Float: amount, weaponid, bodypar
if ( GetPlayerArmour( playerid, armour ) )
{
DestroyObject( p_DamageObject[ playerid ] );
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 );
//Streamer_Update( playerid, STREAMER_TYPE_OBJECT );
p_GotHit{ playerid } = true;
}
}
@ -194,8 +196,10 @@ public OnPlayerTakenDamage( playerid, issuerid, Float: amount, weaponid, bodypar
function HideDamageObject( playerid )
{
if( IsValidObject( p_DamageObject[ playerid ] ) )
if( IsValidObject( p_DamageObject[ playerid ] ) ) {
DestroyObject( p_DamageObject[ playerid ] );
p_DamageObject[ playerid ] = -1;
}
p_GotHit{ playerid } = false;
return 1;