26.01.2014, 20:08
Hello, i have a question, on my server is a one bug he is: Player death received x4 or x5 message...
This is my onplayergivedamage.
I need kill afk player
This is my onplayergivedamage.
I need kill afk player
PHP код:
public OnPlayerGiveDamage ( playerid, damagedid, Float: amount, weaponid )
{
if ( damagedid == INVALID_PLAYER_ID ) return 1;
new
Float: HP,
Float: AP
;
GetPlayerHealth ( damagedid, HP );
GetPlayerArmour ( damagedid, AP );
if ( AP >= amount )
{
SetPlayerArmour ( damagedid, AP - amount );
}
else if ( AP <= 0 )
{
new const Float: remainHP = HP - amount;
SetPlayerHealth ( damagedid, remainHP );
if ( remainHP <= 0 ) OnPlayerDeath ( damagedid, playerid, weaponid );
}
else
{
new const Float: remainHP = HP + ( AP - amount );
SetPlayerArmour ( damagedid, 0.0 );
SetPlayerHealth ( damagedid, remainHP );
if ( remainHP <= 0 ) OnPlayerDeath ( damagedid, playerid, weaponid );
}
if(damagedid != INVALID_PLAYER_ID && weaponid == 34)
{
SetPlayerHealth(damagedid, 0.0);
}
return 1;
}