Anti-cheat help :(
#1

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:

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;
       }
     }
}
A timer is set at gamemodinit

pawn Code:
SetTimer("healthhackcheck",3000,0);
Everytime SetPlayerHealth is used, that variable "gainhealth" is set to 1
Reply
#2

pawn Code:
SetTimer("healthhackcheck",3000,0);
The 0 as last variable means that the timer is only called once wich means that the timer will be called 3 seconds after starting the server and thats all.
Change the 0 to 1 ahd if your code works you're anti-cheat will work
Reply
#3

Quote:
Originally Posted by FUNExtreme
pawn Code:
SetTimer("healthhackcheck",3000,0);
The 0 as last variable means that the timer is only called once wich means that the timer will be called 3 seconds after starting the server and thats all.
Change the 0 to 1 ahd if your code works you're anti-cheat will work
Lol such a stupid mistake :P

Thanks it works now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)