16.03.2010, 21:29
I am trying to script a type of health anti-cheat but it just won't work properly...
As soon as i enter the server i keep getting "-> Cheater" message.
Normaly i shouldn't get it since i don't hack but i keep getting it.
The code looks like it should work but it just doesn't.
Anyone can figure out the problem?
Код:
//The function below is called every 250ms
public HealthCheck()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && GetPlayerState(i) != PLAYER_STATE_SPECTATING && GetPlayerState(i) != PLAYER_STATE_WASTED)
{
new Float:health;
GetPlayerHealth(i, health);
if(health >= 100.0)
{
SetPlayerHealth(i, 75.0);
GetPlayerHealth(i, health);
if(health > 75.0)
{
SendClientMessage(i, COLOR_RED, "-> Cheater");
}
else
{
SendClientMessage(i, COLOR_RED, "-> Clean");
SetPlayerHealth(i, 100.0);
}
}
}
}
Normaly i shouldn't get it since i don't hack but i keep getting it.
The code looks like it should work but it just doesn't.
Anyone can figure out the problem?

