Onplayerdeath and afk kill - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Onplayerdeath and afk kill (
/showthread.php?tid=490500)
Onplayerdeath and afk kill -
Bogdanphr - 26.01.2014
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
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;
}
Re: Onplayerdeath and afk kill -
Manyula - 27.01.2014
I don't get what you're aiming at.
What is the code supposed to do, and what is is actually doing? Any errors?
Re: Onplayerdeath and afk kill -
Scottas - 27.01.2014
You don't have to call OnPlayerDeath if players HP is 0, because it's automaticaly called when player dies.
Re: Onplayerdeath and afk kill -
Bogdanphr - 27.01.2014
if the player is afk onplayerdeath not called and afk player hp down with 50%
Onplayerdeath send spam with message for automatic weapons
http://s12.postimg.org/5op5b3uhp/sa_mp_004.png
Re: Onplayerdeath and afk kill -
Bogdanphr - 27.01.2014
BUMP