Skip to main content

OnPlayerGiveDamageActor

warning

Callback นี้ถูกเพิ่มใน SA-MP 0.3.7 และจะไม่ทำงานในเวอร์ชั่นก่อนหน้านี้!

คำอธิบาย

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

ส่งคืน

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, WEAPON: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;
}

บันทึก

tip

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

ฟังก์ชั่นที่เกี่ยวข้องกัน