跳到主要内容

OnPlayerGiveDamageActor

注意

这个回调是在SA-MP 0.3.7中添加的,在以前的版本中不起作用!

描述

当玩家对角色造成伤害时触发该回调函数。

参数名说明
playerid造成伤害的玩家ID
damaged_actorid受到伤害的角色ID
Float:amount损失的生命值/护甲值(单位:浮点数)
WEAPON:weaponid造成伤害的武器类型
bodypart被击中的身体部位

返回值

1 - 阻止其他滤镜脚本接收此回调

0 - 允许将此回调传递给其他滤镜脚本

该回调始终在滤镜脚本中优先触发,返回1将阻止其他滤镜脚本处理

示例

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 对角色ID %d 造成了 %.0f 点伤害,武器:%s", attackerName, damaged_actorid, amount, weaponName);
SendClientMessageToAll(0xFFFFFFFF, string);
return 1;
}

注意事项

提示

若角色设置为无敌状态(默认状态),此回调不会被触发。详见SetActorInvulnerable

相关回调

以下回调函数可能与本回调相关:

相关函数

以下函数可能与本回调函数相关:

相关资源