14.03.2009, 16:24
Quote:
Originally Posted by Weirdosport
Quote:
20-70 = -50 -50 is not > 40 |
EDIT:
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;
}
}