SA-MP Forums Archive
Can you get specific damage taken from a bodypart? - 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: Can you get specific damage taken from a bodypart? (/showthread.php?tid=505832)



Can you get specific damage taken from a bodypart? - Dokins - 10.04.2014

title says all...

How can I check what bodypart recieved the most damage, if this is possible?


Re: Can you get specific damage taken from a bodypart? - Konstantinos - 10.04.2014

Something like that but you'll need to modify it to your needs:
pawn Код:
#define INVALID_BODYPART (255)
   
static
    Player_Bodypart[MAX_PLAYERS char],
    Float: Player_MaxDamage[MAX_PLAYERS];

// OnPlayerConnect:
Player_Bodypart{playerid} = INVALID_BODYPART;
Player_MaxDamage[playerid] = 0.0;

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID) // damage that took from a player
    {
        if (amount && amount > Player_MaxDamage[playerid]) // not 0.0 and greater than the already stored
        {
            Player_Bodypart{playerid} = bodypart;
        }
    }
    return 1;
}
Player_Bodypart will store the bodypart ID for the higher damage. Those body parts can be found: https://sampwiki.blast.hk/wiki/Body_Parts


Re: Can you get specific damage taken from a bodypart? - Dokins - 10.04.2014

Thank you very much!