14.03.2009, 16:21
pawn Code:
new Float:faPlayerHealth[MAX_PLAYERS]; // float-array storing all players health.
public OnPlayerUpdate(playerid)
{
new Float:fHealth;
GetPlayerHealth(playerid, fHealth);
if(fHealth != faPlayerHealth[playerid])
{
// Player health has changed since last update from player -> server, so obviously thats the thing updated.
// Lets do further checks see if he've lost or gain health, anti health cheat? ;-)
if(fHealth > faPlayerHealth[playerid])
{
/* He've gained health! Cheating? Write your own scripts here to figure how a player
gained health! */
}
else if((fHealth - faPlayerHealth[playerid]) > 40)
{
SetPlayerHealth(playerid,0);
}
faPlayerHealth[playerid] = fHealth;
}
}
It's supposed to kill the player if he looses more then 40 hp on the update...