Anti cheat not working. - 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)
+--- Thread: Anti cheat not working. (
/showthread.php?tid=656255)
Anti cheat not working. -
Fabyx15 - 11.07.2018
I made an anti-cheat, but when i explode someone and the damage is taken, ac is saying that player is hacking..
Код:
CMD:achh(playerid, params[])
{
new userid, Float:x, Float:y, Float:z, Float:ohp, Float:oar, Float:nhp, Float:nar;
if(PlayerInfo[playerid][pAdmin] < 2) return SCM(playerid,COLOR_ERROR,"Error: You must be admin level 2!");
if(sscanf(params, "u", userid)) return SCM(playerid,COLOR_GREY,"Usage: /achh [UserID]");
else if(userid == INVALID_PLAYER_ID) return SCM(playerid,COLOR_ERROR,"Error: Player is not connected!");
else if(userid == playerid) return SCM(playerid,COLOR_ERROR,"Error: You cannot use this command on yourself!");
else
{
GetPlayerHealth(userid, ohp);
GetPlayerArmour(userid, oar);
GetPlayerPos(userid, x, y, z);
CreateExplosion(x, y, z, 7, 10.0);
SCM(playerid,0xFF4D4DFF,"{FF4D4D}[ANTI-CHEAT]: {DED9D9}Explosion created, wait for results!");
GetPlayerHealth(userid, nhp);
GetPlayerArmour(userid, nar);
if(ohp != nhp && oar != nar) return SCM(playerid,0xFF4D4DFF,"{FF4D4D}[ANTI-CHEAT] {DED9D9}RESULTS: {5AE66F}Player is not having HH!"), SCM(userid,-1,"{FF4D4D}[ANTI-CHEAT]: {DED9D9}You've been exploded due Hack Acusations!");
if(ohp == nhp && oar == nar) return SCM(playerid,0xFF4D4DFF,"{FF4D4D}[ANTI-CHEAT] {DED9D9}RESULTS: {E65A5A}Player is having HH!"), SCM(userid,COLOR_ERROR,"{FF4D4D}[ANTI-CHEAT]: You've been kicked from the server! Reason: Using HealthHack");
}
return 1;
}
Re: Anti cheat not working. -
diego200052 - 11.07.2018
First print the values to see what is happening. Like this:
pawn Код:
new string[254];
format(string, sizeof(string), "ohp: %f, oar: %f", ohp, oar);
SendClientMessage(playerid, 0xFFFFFFFF, string);
format(string, sizeof(string), "nhp: %f, nar: %f",nhp, nar);
SendClientMessage(playerid, 0xFFFFFFFF, string);
And see the values.
Re: Anti cheat not working. -
Dayrion - 11.07.2018
Dont compare 2 exact float values. 9.33333 isn't the same thing as 9.3333333