Przejdź do głównej zawartości

OnPlayerGiveDamageActor

warning

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.

NameDescription
playeridThe ID of the player that gave damage.
damaged_actoridThe ID of the actor that received damage.
Float:amountThe amount of health/armour damaged_actorid has lost.
WEAPON:weaponidThe reason that caused the damage.
bodypartThe body part that was hit

Returns

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 processing it.

Examples

public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, WEAPON:weaponid, bodypart)
{
new string[128];
new attackerName[MAX_PLAYER_NAME];
new weaponName[24];

GetPlayerName(playerid, attackerName, sizeof (attackerName));
GetWeaponName(weaponid, weaponName, sizeof (weaponName));

format(string, sizeof(string), "%s has made %.0f damage to actor id %d, weapon: %s", attackerName, amount, damaged_actorid, weaponName);
SendClientMessageToAll(0xFFFFFFFF, string);
return 1;
}

Notes

wskazówka

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

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

  • OnActorStreamOut: This callback is called when an actor is streamed out by a player's client.
  • OnActorStreamIn: This callback is called when an actor is streamed in by a player's client.

The following functions might be useful, as they're related to this callback in one way or another.