Coldheart, your Anti-Armour and Anti-Health code will NEVER work.
1) GetPlayerHealth will only return values between 0 and 255 (as far as I know).
2) Why would you ban someone with full armour? That's not cheating?
3) Actually the code for checking health and armour is nonsense:
pawn Код:
if(GetPlayerHealth(playerid, health) > 999999)
if(GetPlayerArmour(playerid, armor) == 100)
GetPlayerHealth and GetPlayerArmour do both NOT return any health/armour value.
compare the variables health and armour with the numbers after you have used GetPlayerHealth/Armour.
pawn Код:
GetPlayerHealth(playerid, health);
if(health > 100)
{
...//If server doesn't set higher amounts of health than 100, the player is a cheater.
Before you try making an anti-cheat, you should know how to use a specific function correctly.
---
Quote:
Originally Posted by gamer931215
Looks nice, however some methods wont work on every hack.
Your checking the player's health as instance if its above 999999, but what if i use cheatengine and set it to 999998 ?
Can't you try something like this (im now sure if this is a good method however):
pawn Код:
for(new i = 0;i<MAX_PLAYERS;i++) { if(!IsPlayerConnected(i)) continue; new Float:health,Float:check; GetPlayerHealth(i,health); SetPlayerHealth(i,(health -1)); //check if you can remove 1 HP GetPlayerHealth(i,check); //verify the check if(check != (health -1) || health > 100) //if the check isnt correct or that the health is above 100 { SendClientMessage(i,COLOR_RED,"You have been kicked by the server (Reason: Health hacks)."); Kick(i); } else { SetPlayerHealth(i,health); //restore the health } }
?
I think its much more effective.
|
This will also not work correctly.
pawn Код:
GetPlayerHealth(i,health);
SetPlayerHealth(i,(health -1)); //check if you can remove 1 HP
GetPlayerHealth(i,check); //verify the check
That's will not work at all because the server does as far as I know (since SA-MP isn't multithread except for HTTP as far as I know) not send/recieve data until the PAWN code has been executed. Even If it would update while PAWN code is executed, the players health would never update fast enough: Player must recieve information that his health has been lowered and also has to send back data of his updated health.