14.03.2009, 16:04
Hey everybody
I'm back with another question...
How to check if the difference between those is more then 40?
EDIT: Example:
(Taken from SAMP Wiki)
I'm back with another question...
How to check if the difference between those is more then 40?
Code:
fHealth
Code:
faPlayerHealth[playerid]
(Taken from SAMP Wiki)
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( Difference between "fHealth" and "faPlayerHealth[playerid]" is more then 40 )
{
/* He've lost health! */
}
faPlayerHealth[playerid] = fHealth;
}
}