OnPlayerGiveDamageActor

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 06:40, 4 October 2015
JernejL (Talk | contribs)

← Previous diff
Revision as of 18:06, 31 December 2016
OstGot (Talk | contribs)

Next diff →
Line 47: Line 47:
[[fr:OnPlayerGiveDamageActor]] [[fr:OnPlayerGiveDamageActor]]
 +[[ru:OnPlayerGiveDamageActor]]

Revision as of 18:06, 31 December 2016


OnPlayerGiveDamageActor was added in SA-MP 0.3.7 This callback was added in SA-MP 0.3.7 and will not work in earlier versions!


Description:

This callback is called when a player gives damage to an actor.



Parameters:
(playerid, damaged_actorid, Float:amount, weaponid, bodypart)
playeridThe ID of the player that gave damage.
damaged_actoridThe ID of the actor that received damage.
amountThe amount of health/armour damaged_actorid has lost.
weaponidThe reason that caused the damage.
bodypartThe body part that was hit


Return Values:

This callback does not handle returns.


Image:32px-Ambox_warning_orange.png

Note

This function does not get called if the actor is set invulnerable (WHICH IS BY DEFAULT). See SetActorInvulnerable.


public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float: amount, weaponid, bodypart)
{
    new string[128], attacker[MAX_PLAYER_NAME];
    new weaponname[24];
    GetPlayerName(playerid, attacker, sizeof (attacker));
    GetWeaponName(weaponid, weaponname, sizeof (weaponname));
 
    format(string, sizeof(string), "%s has made %.0f damage to actor id %d, weapon: %s", attacker, amount, damaged_actorid, weaponname);
    SendClientMessageToAll(0xFFFFFFFF, string);
    return 1;
}

Related Functions

The following functions may be useful, as they are related to this function in one way or another.


Related Callbacks

The following callbacks might be useful as well, as they are related to this callback in one way or another.

Personal tools
In other languages