Skip to content

Commit 90b6fa2

Browse files
committed
Fix parameter name from 'damage' to 'amount' and from 'damagerid' to 'issuerid' OnNPCTakeDamage callback
1 parent c8fc267 commit 90b6fa2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

frontend/docs/scripting/callbacks/OnNPCTakeDamage.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ This callback is called when an NPC takes damage from a player or another NPC.
1414
| Name | Description |
1515
| --------- | ---------------------------------------------------- |
1616
| npcid | The ID of the NPC that took damage |
17-
| damagerid | The ID of the player/NPC that caused the damage |
18-
| damage | The amount of damage that was taken |
17+
| issuerid | The ID of the player/NPC that caused the damage |
18+
| amount | The amount of damage that was taken |
1919
| weaponid | The weapon ID used to cause the damage |
2020
| bodypart | The [body part](../resources/bodyparts) that was hit |
2121

@@ -26,7 +26,7 @@ Return `false` to prevent the damage from being applied, or `true` to allow it.
2626
## Examples
2727

2828
```c
29-
public OnNPCTakeDamage(npcid, damagerid, Float:damage, WEAPON:weaponid, bodypart)
29+
public OnNPCTakeDamage(npcid, issuerid, Float:amount, WEAPON:weaponid, bodypart)
3030
{
3131
// Only notify players tracking this NPC
3232
for (new playerid = 0; playerid < MAX_PLAYERS; playerid++)
@@ -36,15 +36,15 @@ public OnNPCTakeDamage(npcid, damagerid, Float:damage, WEAPON:weaponid, bodypart
3636

3737
if (PlayerNPC[playerid] == npcid)
3838
{
39-
if (damagerid == INVALID_PLAYER_ID)
39+
if (issuerid == INVALID_PLAYER_ID)
4040
{
4141
SendClientMessage(playerid, 0xFF8800FF, "NPC %d took %.1f damage (weapon: %d, bodypart: %d)",
42-
npcid, damage, _:weaponid, bodypart);
42+
npcid, amount, _:weaponid, bodypart);
4343
}
4444
else
4545
{
4646
SendClientMessage(playerid, 0xFF8800FF, "NPC %d took %.1f damage from player %d (weapon: %d, bodypart: %d)",
47-
npcid, damage, damagerid, _:weaponid, bodypart);
47+
npcid, amount, issuerid, _:weaponid, bodypart);
4848
}
4949
}
5050
}
@@ -56,7 +56,7 @@ public OnNPCTakeDamage(npcid, damagerid, Float:damage, WEAPON:weaponid, bodypart
5656
5757
- This callback is called before the damage is actually applied to the NPC
5858
- Returning `false` will prevent the damage from being applied
59-
- The `damagerid` parameter will be `INVALID_PLAYER_ID` if damage is not caused by player
59+
- The `issuerid` parameter will be `INVALID_PLAYER_ID` if damage is not caused by player
6060
- Body parts use the same constants as `OnPlayerTakeDamage`
6161
6262
## Related Functions

0 commit comments

Comments
 (0)