Anti-cheat help :( - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Anti-cheat help :( (
/showthread.php?tid=78282)
Anti-cheat help :( -
viper_viper - 18.05.2009
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
Re: Anti-cheat help :( -
FUNExtreme - 18.05.2009
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
Re: Anti-cheat help :( -
viper_viper - 18.05.2009
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