SA-MP Forums Archive
anti cheat - 180* turn - help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: anti cheat - 180* turn - help (/showthread.php?tid=73942)



anti cheat - 180* turn - help - StrickenKid - 18.04.2009

some cheat programs have a hotkey that will automatically turn you car 180 degrees. im making a code to detect that but need some help.. im not that familiar with the floatound and floatpower things.

Heres what i got so far. It DOES work but its just not that accurate and it only detects if your going strait. of your turning while you press the hotkey to turn you 180 it doesn't detect

pawn Код:
public AntiAutoTurn()
{
    new Float:angle;
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInAnyVehicle(i))
            {
                new currentveh;
                currentveh = GetPlayerVehicleID(i);
                GetVehicleZAngle(currentveh, angle);
                //new str[32];
                //format(str,32,"%f",angle);
                //SendClientMessage(i,COLOR_RED,str);
                if(floatround(angle) == floatround(LastA[i])+180 || floatround(angle) == floatround(LastA[i])-180)
                {
                    Kick(i);
                    break;
                }
                LastA[i] = angle;
            }
        }
    }
}
note: timer is going at 1000 milliseconds and is looping.


Re: anti cheat - 180* turn - help - Dark_Kostas - 18.04.2009

What if you add that code on OnPlayerUpdate? It will be more accurate
pawn Код:
if(IsPlayerInAnyVehicle(i))
            {
                new currentveh;
                currentveh = GetPlayerVehicleID(i);
                GetVehicleZAngle(currentveh, angle);
                //new str[32];
                //format(str,32,"%f",angle);
                //SendClientMessage(i,COLOR_RED,str);
                if(floatround(angle) == floatround(LastA[i])+180 || floatround(angle) == floatround(LastA[i])-180)
                {
                    Kick(i);
                    break;
                }
                LastA[i] = angle;
            }
Also nice idea!


Re: anti cheat - 180* turn - help - Weirdosport - 18.04.2009

Turning exactly 180 is very precise.. if you turn 180 the slope of the ground is likely to turn you an extra 0.0000349 or whatever...


Re: anti cheat - 180* turn - help - StrickenKid - 18.04.2009

alright ill put it under onplayerupdate and hax my server and see how it goes. Also Thanks.


Re: anti cheat - 180* turn - help - StrickenKid - 18.04.2009

*bump*

ok when on onplayer update its 100% accurate and even when turning it will get you. only one bad thing. after i got kicked, the server crashed... tried it another time just to make sure and it still crashed. if we figure out how to stop the server crash, we got a 100% accurate 180* turn anticheat.

EDIT: wait im a moron. i forgot to add "return 1;", ill put that in and test.


Re: anti cheat - 180* turn - help - Dark_Kostas - 18.04.2009

Its fully working on me, i tried that one.

pawn Код:
public OnPlayerUpdate(playerid)
{
  if(IsPlayerInAnyVehicle(playerid))
    {
        new currentveh, Float:angle;
        currentveh = GetPlayerVehicleID(playerid);
        GetVehicleZAngle(currentveh, angle);
        new str[32];
        format(str,32,"%f",angle);
        SendClientMessage(playerid,COLOR_ZOMBIE,str);
        if(floatround(angle) == floatround(LastA[playerid])+180 || floatround(angle) == floatround(LastA[playerid])-180)
        {
          SendClientMessage(playerid,COLOR_ZOMBIE," You did 180 !");
            //Kick(playerid);
            return 1;
        }
        LastA[playerid] = angle;
    }
    return 1;
}
The only problem is that, if you are steering left or right, it will not detect you.


Re: anti cheat - 180* turn - help - StrickenKid - 18.04.2009

sometimes it does detect if your turning, sometimes it doesn't (for me)

heres my code:

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerSpawned[playerid] == 1)
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                new Float:angle;
                new currentveh;
                currentveh = GetPlayerVehicleID(playerid);
                GetVehicleZAngle(currentveh, angle);
                if((floatround(angle) == floatround(LastA[playerid])+180) || (floatround(angle) == floatround(LastA[playerid])-180))
                {
                    AC_Kill(playerid);
                }
                LastA[playerid] = angle;
            }
        }
    }
    return 1;
}
some of the functions are mine so you want have them.


Re: anti cheat - 180* turn - help - yom - 18.04.2009

You need to check if difference is between a range (160 to 200 for example) and also check if the speed is more or less the same after turn.


Re: anti cheat - 180* turn - help - Joe Staff - 18.04.2009

On a more laggy player, he might get kicked if he/she does a 180 turn too fast assuming you do the 160-200


Re: anti cheat - 180* turn - help - StrickenKid - 19.04.2009

im keeping it how it is for now. it does a pretty good job and has already gotten server players on my server :P