20.01.2014, 04:59
What do you think about this code? It should detect a health hacker
I tested it with server-side godmode(setting player's health to infinite), so far it works. But, I need your opinion. Maybe there's something that I forgot?
pawn Код:
new hit[MAX_PLAYERS], Float:oldhealth[MAX_PLAYERS], Float:newhealth[MAX_PLAYERS];
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
switch(hittype)
{
case BULLET_HIT_TYPE_PLAYER:
{
hit[hitid]++;
switch(hit[hitid])
{
case 1..3: GetPlayerHealth(hitid, oldhealth[hitid]);
case 4..6:
{
GetPlayerHealth(hitid, newhealth[hitid]);
if(newhealth[hitid] == oldhealth[hitid])
{
//Ban(playerid); //cheat
SendClientMessage(playerid, -1, "cheat");
}
}
default:hit[hitid] = 0;
}
}
}
return 1;
}