30.09.2013, 15:22
If you really want normal kill prints use this
but i dont know is this a good idea
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount)
{
if(!(0 <= damagedid < MAX_PLAYERS)) return; // small anti against cheaters
new Float:health, Float:armour;
GetPlayerArmour(damagedid, armour);
if( armour < 0.1 ) // No armour, just take health
{
GetPlayerHealth(damagedid, health);
health -= amount;
if(health < 0.0)
{
OnPlayerDeath(damagedid, playerid, GetPlayerWeapon(playerid)); // if you want call OnPlayerDeath only in GM ( Example 1 )
CallLocalFunction("OnPlayerDeath", "iii", damagedid, playerid, GetPlayerWeapon(playerid)); // if you want call OnPlayerDeath only in GM ( Example 2 )
CallRemoteFunction("OnPlayerDeath", "iii", damagedid, playerid, GetPlayerWeapon(playerid)); // if you want call OnPlayerDeath in all FS and GM
// Choose one method
return;
}
SetPlayerHealth(damagedid, health);
return;
}
else // There is armour, take what is needed
{
health = ( armour - amount );
if( health < 0.0 ) // Health needs to be taken
{
GetPlayerHealth(damagedid, health);
health -= ( amount - armour );
SetPlayerHealth(damagedid, health);
SetPlayerArmour(damagedid, 0.0);
}
else
SetPlayerArmour(damagedid, health);
}
return;
}