enum pInfo
{
//other stuff
pAdmin,
pACDetected
}
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
//other stuff here
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"ACDetected",PlayerInfo[playerid][pACDetected]);
INI_Close(File);
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
//other stuff here
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
//other stuff here
INI_Int("ACDetected",PlayerInfo[playerid][pACDetected]);
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
return 1;
}
if(PlayerInfo[playerid][pAdmin] == 0) //if he isn't an admin
{
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(PlayerInfo[playerid][pAdmin] == 0) //if he isn't an admin
{
//script will be here
}
return 1;
}
if(PlayerInfo[playerid][pACDetected] == 0) //Y_INI enum, if the player hasn't been detected by the anti-cheat
{
new Float:armour;
GetPlayerArmour(playerid, armour);
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(PlayerInfo[playerid][pAdmin] == 0) //if he isn't an admin
{
if(PlayerInfo[playerid][pACDetected] == 0) //Y_INI enum, if the player hasn't been detected by the anti-cheat
{
new Float:armour;
GetPlayerArmour(playerid, armour);
}
}
return 1;
}
if(armour == 0) //if his armour is 0
{
new string[94];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new Float:health;
GetPlayerHealth(playerid,health);
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(PlayerInfo[playerid][pAdmin] == 0) //if he isn't an admin
{
if(PlayerInfo[playerid][pACDetected] == 0) //Y_INI enum, if the player hasn't been detected by the anti-cheat
{
new Float:armour;
GetPlayerArmour(playerid, armour);
if(armour == 0) //if his armour is 0
{
new string[94]; //String for a message
new name[MAX_PLAYER_NAME]; //Gets the hackers(players) name
GetPlayerName(playerid, name, sizeof(name));
new Float:health; //Gets the hackers(players) health
GetPlayerHealth(playerid,health);
}
}
}
return 1;
}
if(health >= 99) //If his health is 99 or more
{
format(string, sizeof(string), "[ANTI-CHEAT] - %s[%d] is POSSIBLY using Health-Hacks!", name, playerid);
SendMessageToAdmins(COLOR_ORANGE, string); //Sends the message to admins
PlayerInfo[playerid][pACDetected] = 1; //Sets him as "Detected by Anti-Cheat", also avoids spam!
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(PlayerInfo[playerid][pAdmin] == 0) //if he isn't an admin
{
if(PlayerInfo[playerid][pACDetected] == 0) //Y_INI enum, if the player hasn't been detected by the anti-cheat
{
new Float:armour;
GetPlayerArmour(playerid, armour);
if(armour == 0) //if his armour is 0
{
new string[94]; //String for a message
new name[MAX_PLAYER_NAME]; //Gets the hackers(players) name
GetPlayerName(playerid, name, sizeof(name));
new Float:health; //Gets the hackers(players) health
GetPlayerHealth(playerid,health);
if(health >= 99) //If his health is 99 or more
{
format(string, sizeof(string), "[ANTI-CHEAT] - %s[%d] is POSSIBLY using Health-Hacks!", name, playerid);
SendMessageToAdmins(COLOR_ORANGE, string); //Sends the message to admins
PlayerInfo[playerid][pACDetected] = 1; //Sets him as "Detected by Anti-Cheat", also avoids spam!
return 1;
}
}
}
}
return 1;
}
stock SendMessageToAdmins(color, text[])
{
for(new i = 0; i < MAX_PLAYERS; i++) //loops trough all the players
{
if(PlayerInfo[i][pAdmin] >= 1) //if his(their) level 1 or more
{
SendClientMessage(i, color, text); //he(they) receive(s) the message
}
}
}
If you tested it 3 to 4x how can it work 99percent ? You would need to test 100 times to be sure.
|
yea it's good i thought about that once but it was so complicated so. thanks for doing this helpfull
btw it's nice that you made the admin get warned not the player that is possible health hack to get banned because im still not sure it's 99% percent |
What's the purpose of y_INI here? To declare variables or arrays, you don't need y_INI. And this thing won't work well. What if SetPlayerHealth is being done? You haven't done much relating. Dude, test it well once again.
|
if(health >= 99 || health < 102) //Change the health < 102 to 101 or 100 or w.e you want to, needs to be MORE than 99
static stock
AC_StartHPTick[ MAX_PLAYERS ];
#define MAX_HPWARNING (3)
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new
string[ 90 ], name[ MAX_PLAYER_NAME ], Float:Health, Float:Armour;
GetPlayerArmour(hitid, Armour), GetPlayerHealth(hitid, Health), GetPlayerName(hitid, name, MAX_PLAYER_NAME);
if(hittype == BULLET_HIT_TYPE_PLAYER)
{
if(Health >= 99.0 && Armour <= 0.0)
{
++ AC_StartHPTick[ playerid ];
}
else if(AC_StartHPTick[ playerid ] >= MAX_HPWARNING)
{
format(string, sizeof(string), "[ANTI-CHEAT] - %s[%d] is POSSIBLY using Health-Hacks!", name, playerid);
SendClientMessageToAll(-1, string);
}
else
{
AC_StartHPTick[ playerid ] = 0;
}
}
return true;
}
I believe Health Hack can be easily detected starting in 0.3z because there is a new callback called OnPlayerWeaponShot, I am not sure if my code will work it is un-tested but I know you can detect Health Hack using OnPlayerWeaponShot
pawn Code:
|
static stock
AC_StartHPTick[ MAX_PLAYERS ];
#define MAX_HPWARNING (3)
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(hittype == BULLET_HIT_TYPE_PLAYER)
{
new
string[ 90 ], name[ MAX_PLAYER_NAME ], Float:Health, Float:Armour;
GetPlayerArmour(hitid, Armour), GetPlayerHealth(hitid, Health), GetPlayerName(hitid, name, MAX_PLAYER_NAME);
if(Health >= 99.0 && Armour <= 0.0)
{
++ AC_StartHPTick[ playerid ];
}
else if(AC_StartHPTick[ playerid ] >= MAX_HPWARNING)
{
format(string, sizeof(string), "[ANTI-CHEAT] - %s[%d] is POSSIBLY using Health-Hacks!", name, playerid);
SendClientMessageToAll(-1, string);
}
else
{
AC_StartHPTick[ playerid ] = 0;
}
}
return true;
}
In my script/gamemode(Call it w.e you want), I've added it so nobodies health can be set over 99.
For me, it works good, as i said above. And as i said again, i did test it 3 - 4x, and all of the times, i didn't have any false results/warnings or w.e. +, it says "Name[ID] is >>POSSIBLY<< health-hacking", not just straight "Name[ID] is health-hacking, 100% sure about it". EDIT: pawn Code:
|