OnPlayerGiveDamage
From SA-MP Wiki
(Difference between revisions)
Revision as of 18:51, 16 January 2014 Smithy (Talk | contribs) ← Previous diff |
Revision as of 22:01, 31 January 2014 Connor Mead (Talk | contribs) Next diff → |
||
Line 1: | Line 1: | ||
{{Scripting}} | {{Scripting}} | ||
- | {{Title}} | ||
{{Description|This callback is called when a player gives damage to another player.}} | {{Description|This callback is called when a player gives damage to another player.}} | ||
Line 44: | Line 43: | ||
[[Category:Scripting Callbacks]] | [[Category:Scripting Callbacks]] | ||
+ | [[fr:OnPlayerGiveDamage]] | ||
[[ru:OnPlayerGiveDamage]] | [[ru:OnPlayerGiveDamage]] |
Revision as of 22:01, 31 January 2014
Description:
This callback is called when a player gives damage to another player.
(playerid, damagedid, Float:amount, weaponid, bodypart)
playerid | The ID of the player that gave damage. |
damagedid | The ID of the player that received damage. |
amount | The amount of health/armour damagedid has lost (combined). |
weaponid | The reason that caused the damage. |
bodypart | The body part that was hit. (NOTE: This parameter was added in 0.3z. Leave it out if using an older version!) |
Return Values:
This callback does not handle returns.
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart) { new string[128], victim[MAX_PLAYER_NAME], attacker[MAX_PLAYER_NAME]; new weaponname[24]; GetPlayerName(playerid, attacker, sizeof (attacker)); GetPlayerName(damagedid, victim, sizeof (victim)); GetWeaponName(weaponid, weaponname, sizeof (weaponname)); format(string, sizeof(string), "%s has made %.0f damage to %s, weapon: %s", attacker, amount, victim, 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.
- OnPlayerTakeDamage: This callback is called when a player takes damage.