30.10.2013, 11:11
So i've been working on in a anti-cheat.
And i've been finding a solution for this but i can't it always fail.
The anti-cheat always detect me as Health/Armour Hack User.
Example. If i damage myself/receives damage, I get banned.
But it doesn't ban me when connecting/disconnecting (well because i set the key - the vars)
Here's how i do it.
And i've been finding a solution for this but i can't it always fail.
The anti-cheat always detect me as Health/Armour Hack User.
Example. If i damage myself/receives damage, I get banned.
But it doesn't ban me when connecting/disconnecting (well because i set the key - the vars)
Here's how i do it.
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
new Float:armour; GetPlayerArmour(playerid, armour);
if(armour > 0)
{
ACArmour[playerid] = ACArmour[playerid] - amount;
SetPlayerArmourEx(playerid, ACArmour[playerid]);
}
else
{
new Float:hp; GetPlayerHealth(playerid, hp);
ACHealth[playerid] = ACHealth[playerid] - amount;
SetPlayerHealthEx(playerid, ACHealth[playerid]);
}
return 1;
}
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
new Float:armour; GetPlayerArmour(damagedid, armour);
if(armour > 0)
{
ACArmour[damagedid] = ACArmour[damagedid] - amount;
SetPlayerArmourEx(damagedid, ACArmour[damagedid]);
}
else
{
new Float:hp; GetPlayerHealth(damagedid, hp);
ACHealth[damagedid] = ACHealth[damagedid] - amount;
SetPlayerHealthEx(damagedid, ACHealth[damagedid]);
}
return 1;
}
//ACHealth[playerid] = 100.0; ACArmour[playerid] = 0.0; OnPlayerConnect/Disconnect
//ACHealth[playerid] = 0.0; OnPlayerDeath.
public AntiCheat()
{
new Query[200],
ip[24]
;
new string[250];
foreach(new i : Player)
{
new weap = GetPlayerWeapon(i),
Float:health,
Float:armour
;
GetPlayerHealth(i, health);
GetPlayerArmour(i, armour);
if(health > 0 && health != ACHealth[i])
{
ClearChatBox(i, 100);
GetPlayerIp(i, ip, 24);
format(string, sizeof string, "» %s(%d) has been banned by AntiCheat | Reason: Health Hack", GetName(i), i);
SendClientMessageToAllEx(COLOR_RED, string);
SendClientMessageEx(i, COLOR_YELLOW, "AntiCheat: "white"[30] Wassup with your heal, Hahaha i caught you!");
SendClientMessageEx(i, COLOR_RED, "You've been banned from the server, Reason: Health Hacks!");
SendClientMessageEx(i, COLOR_GREEN, "If you think this is mistake create a ban appeal on the forum!");
format(Query, sizeof(Query), "UPDATE `bans` SET `Temporary` = 0, `IP` = '%s', `Month` = 1, `Days` = 1, `Years` = 1970, `NAME` = '%s', `REASON` = 'Health Hacks', `BannedBy` = 'AC' WHERE `NAME` = '%s'", ip, DB_Escape(GetName(i)), DB_Escape(GetName(i)));
db_query(Database, Query);
db_free_result(db_query(Database, Query));
KickDelay(i);
format(string, sizeof string, "%s has been banned by Anitcheat, Reason: Health Hack", GetName(i));
SaveLogs("aclog", string);
return 1;
}
if(armour > 0 && armour != ACArmour[i])
{
ClearChatBox(i, 100);
GetPlayerIp(i, ip, 24);
format(string, sizeof string, "» %s(%d) has been banned by AntiCheat | Reason: Armour Hack", GetName(i), i);
SendClientMessageToAllEx(COLOR_RED, string);
SendClientMessageEx(i, COLOR_YELLOW, "AntiCheat: "white"[30] Wassup with your armour shield, Hahaha i caught you!");
SendClientMessageEx(i, COLOR_RED, "You've been banned from the server, Reason: Armour Hacks!");
SendClientMessageEx(i, COLOR_GREEN, "If you think this is mistake create a ban appeal on the forum!");
format(Query, sizeof(Query), "UPDATE `bans` SET `Temporary` = 0, `IP` = '%s', `Month` = 1, `Days` = 1, `Years` = 1970, `NAME` = '%s', `REASON` = 'Armour Hacks', `BannedBy` = 'AC' WHERE `NAME` = '%s'", ip, DB_Escape(GetName(i)), DB_Escape(GetName(i)));
db_query(Database, Query);
db_free_result(db_query(Database, Query));
KickDelay(i);
format(string, sizeof string, "%s has been banned by Anitcheat, Reason: Armour Hack", GetName(i));
SaveLogs("aclog", string);
return 1;
}
}
return 1;
}
forward SetPlayerHealthEx(playerid, Float:health);
public SetPlayerHealthEx(playerid, Float:health)
{
ACHealth[playerid] = health;
return SetPlayerHealth(playerid, ACHealth[playerid]);
}
forward SetPlayerArmourEx(playerid, Float:armour);
public SetPlayerArmourEx(playerid, Float:armour)
{
ACArmour[playerid] = armour;
return SetPlayerArmour(playerid, ACArmour[playerid]);
}