Callback OnPlayerGiveDamageActor is called when a player gives damage to an actor.
Callback OnPlayerGiveDamageActor was added in 0.3.7 and will not work in earlier versions!
Callback OnPlayerGiveDamageActor does not get called if the actor is set invulnerable (WHICH IS BY DEFAULT). See SetActorInvulnerable.

(playerid, damaged_actorid, Float:amount, weaponid, bodypart)
int playerid The ID of the player that gave damage.
int damaged_actorid The ID of the actor that received damage.
float amount The amount of health/armour damaged_actorid has lost.
int weaponid The reason that caused the damage.
int bodypart The body part that was hit.

Return Values:
  • 1 - Callback will not be called in other filterscripts.
  • 0 - Allows this callback to be called in other filterscripts.
  • It is always called first in filterscripts so returning 1 there blocks other filterscripts from seeing it.

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 Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.

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