Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
new Float:hp;
GetPlayerHealth(playerid,hp);
new Float:damage = (amount > hp) ? hp : amount;
if (Player[issuerid][pTeam] == T_REF && Current != -1 && Player[playerid][pPlaying])
{
SetPlayerHealth(issuerid, 0);
}
if(Current != -1)
{
if((Player[issuerid][pPlaying] && Player[playerid][pPlaying]) && (!Player[issuerid][pDm] && !Player[playerid][pDm]) && (Player[issuerid][pTeam] != Player[playerid][pTeam]) && (Player[issuerid][pTeam] != T_REF && Player[playerid][pTeam] != T_REF))
{
gRoundDamage[issuerid] += floatround(damage);
gRoundDamage2[issuerid] += floatround(damage);
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
}
}
else
{
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
}
if(Current != -1)
{
if((Player[issuerid][pTeam] != Player[playerid][pTeam]) && (Player[issuerid][pTeam] != T_REF && Player[playerid][pTeam] != T_REF))
{
currentHpLoss[0][issuerid][playerid] += damage;
currentHpLoss[1][playerid][issuerid] += damage;
new buffer[128];
format(buffer, 128, "~g~Hit: %s~w~ (~g~Weapon: %s~w~)~g~ -~w~ (Damage: ~g~%i~w~)", PNames[playerid], WeaponNames[weaponid], floatround(currentHpLoss[0][issuerid][playerid]));
TextDrawSetString(txd[dodmg][issuerid], buffer);
format(buffer, 128, "~r~Hit by: %s~w~ (~r~Weapon: %s~w~)~r~ -~w~ (Damage: ~r~%i~w~)", PNames[issuerid], WeaponNames[weaponid], floatround(currentHpLoss[1][playerid][issuerid]));
TextDrawSetString(txd[takedm][playerid], buffer);
txdAlpha[0][issuerid] = 0xFF;
txdAlpha[1][playerid] = 0xFF;
}
}
else
{
currentHpLoss[0][issuerid][playerid] += damage;
currentHpLoss[1][playerid][issuerid] += damage;
new buffer[128];
format(buffer, 128, "~g~Hit: %s~w~ (~r~Weapon: %s~w~)~g~ -~w~ (Damage: ~g~%i~w~)", PNames[playerid], WeaponNames[weaponid], floatround(currentHpLoss[0][issuerid][playerid]));
// format(buffer, 128, "%s~n~-%i (%s)", PNames[playerid], floatround(currentHpLoss[0][issuerid][playerid]), WeaponNames[weaponid]);
TextDrawSetString(txd[0][issuerid], buffer);
format(buffer, 128, "~r~Hit by: %s~w~ (~r~Weapon: %s~w~)~r~ -~w~ (Damage: ~r~%i~w~)", PNames[issuerid], WeaponNames[weaponid], floatround(currentHpLoss[1][playerid][issuerid]));
// format(buffer, 128, "%s~n~-%i (%s)", PNames[issuerid], floatround(currentHpLoss[1][playerid][issuerid]), WeaponNames[weaponid]);
TextDrawSetString(txd[1][playerid], buffer);
txdAlpha[0][issuerid] = 0xFF;
txdAlpha[1][playerid] = 0xFF;
}
return 1;
}