PHP код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
new Float:oldhealth; // victim health before taking damage
GetPlayerHealth(playerid,oldhealth); // victim health before taking damage
new currenthp = oldhealth - amount; // calculating current health after taking damage
if(currenthp == 0.0) {
new
Float:kx, Float:ky, Float:kz,
string[156],
WeaponName[24],
VictimName[MAX_PLAYER_NAME],
KillerName[MAX_PLAYER_NAME];
// killer coordinates variables
GetPlayerPos(issuerid, kx, ky, kz);
// their positions and distance between them
new Float: PfPDistance = GetPlayerDistanceFromPoint(playerid, kx, ky, kz);
GetPlayerName(playerid, VictimName, sizeof (VictimName));
GetPlayerName(issuerid, KillerName, sizeof (KillerName));
GetWeaponName(weaponid, WeaponName, sizeof (WeaponName));
format(string, sizeof(string), "%s (%i) Killed %s (%i) - %s (%s) From %0.2fm Away.", KillerName, issuerid, VictimName, playerid, WeaponName, bodypart, PfPDistance);
SendClientMessageToAll(playerid, 0x9D000096, string);
}
return 1;
}
// code may have some kind of errors + idk if bodypart returns an integer or string.