anti cheat - 180* turn - help
#1

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.
Reply
#2

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!
Reply
#3

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...
Reply
#4

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

*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.
Reply
#6

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.
Reply
#7

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.
Reply
#8

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.
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 3 Guest(s)