18.05.2009, 18:39
Me any my friend are making an anti-cheat for his server but we dont seem to get much luck Basically nothing happens. we got health legally, nothing happened. We then got health illegally, nothing happened. Heres the code:
A timer is set at gamemodinit
Everytime SetPlayerHealth is used, that variable "gainhealth" is set to 1
pawn Code:
public healthhackcheck()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
new Float:fHealth;
GetPlayerHealth(i, fHealth);
if(fHealth != faPlayerHealth[i])
{
if(fHealth > faPlayerHealth[i])
{
if ( gainedhealth[i] == 0 ) {
new string[200];
new pname[200];
GetPlayerName(i, pname, 24);
format(string, 100, "**(AUTO BAN)** %s(%d) Health hacks detected", string,i);
SendClientMessageToAll(0xFF7F50AA, string);
}
if(gainedhealth[i] == 1)
{
gainedhealth[i] =0;
}
}
faPlayerHealth[i] = fHealth;
}
}
}
pawn Code:
SetTimer("healthhackcheck",3000,0);