SA-MP Forums Archive
How to take less damage using OnPlayerTakeDamage? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to take less damage using OnPlayerTakeDamage? (/showthread.php?tid=325083)



How to take less damage using OnPlayerTakeDamage? - Marricio - 11.03.2012

Hello everyone I have this script

pawn Код:
if ( issuerid != INVALID_PLAYER_ID || issuerid == INVALID_PLAYER_ID )
    {
        //xxxxxxxxxxxxxxxxxxxxxxxxxx
        {
            if ( amount > 2 )
            {
                new Float:playerHp;
                GetPlayerHealth( playerid, playerHp );
                SetPlayerHealth( playerid, playerHp + ( amount*15/100 ) ); // give back 15% of the health..
            }
        }
    }
But when I take a damage my HP is reset back to 100. Why?


Re: How to take less damage using OnPlayerTakeDamage? - telmo_ferreira - 11.03.2012

try this
Код:
if ( issuerid != INVALID_PLAYER_ID || issuerid == INVALID_PLAYER_ID )
    {
        //xxxxxxxxxxxxxxxxxxxxxxxxxx
        {
            if ( amount > 2 )
            {
                new Float:playerHp;
                GetPlayerHealth( playerid, playerHp );
                SetPlayerHealth( playerid, playerHp - ( amount*15/100 ) ); // give back 15% of the health..
            }
        }
    }



Re: How to take less damage using OnPlayerTakeDamage? - Marricio - 12.03.2012

Thank you but it didn't work, how can I make so you only take 75% of the health instead of the full damage? i need this urgently


Re: How to take less damage using OnPlayerTakeDamage? - Marricio - 13.03.2012

Bump


Re: How to take less damage using OnPlayerTakeDamage? - telmo_ferreira - 13.03.2012

Код:
if ( issuerid != INVALID_PLAYER_ID || issuerid == INVALID_PLAYER_ID )
    {
        //xxxxxxxxxxxxxxxxxxxxxxxxxx
        {
            if ( amount > 2 )
            {
                new Float:playerHp;
                GetPlayerHealth( playerid, playerHp );
                SetPlayerHealth( playerid, playerHp - ( amount/100 *75) ); 
            }
        }
    }



Respuesta: How to take less damage using OnPlayerTakeDamage? - Marricio - 13.03.2012

it kills me.. What can I do to effectively take only 75% of the damage?