07.08.2012, 16:52
I have this code, that really works it's awesome, but I have a problem with it. It uses SetPlayerHealth, so sometimes when a player kills a player, in the death message it's saying that he commited a suicide (because when you set a players health to 0 with SetPlayerHealth, that message comes up).
Code:
So how to edit that code, when a player kills a player, it will send a death message that the player killed him, not the SetPlayerHealth (suicide) message.
Code:
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
if(damagedid != INVALID_PLAYER_ID)
{
if(gTeam[playerid] != gTeam[damagedid])
{
new Float:HEALTH;
new Float:ARMOR;
new Float:DAMAGE;
GetPlayerArmour(damagedid, ARMOR);
GetPlayerHealth(damagedid, HEALTH);
if(ARMOR > 0)
{
if(amount > ARMOR)
{
ARMOR = 0;
SetPlayerArmour(damagedid, 0.0);
SetPlayerHealth(damagedid, HEALTH);
return 1;
}
else
{
DAMAGE = ARMOR-amount;
SetPlayerArmour(damagedid, DAMAGE);
SetPlayerHealth(damagedid, HEALTH);
}
}
if(ARMOR < 1)
{
HEALTH = HEALTH - amount;
SetPlayerHealth(damagedid, HEALTH);
}
}
}
return 1;
}