SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 02/03/2018, 03:15 PM   #1
StrikerZ
High-roller
 
StrikerZ's Avatar
 
Join Date: Mar 2016
Location: India
Posts: 1,104
Reputation: 154
Default (sQt) Anti Quick-Turn

Anti Quick-Turn


Code:
The include has been tested for any bugs and so far it's working perfectly.

If you find any bug, report it here.
Introduction:
This include is meant to detect player's using quick-turn hack. It has been made sure that the passenger won't be detected as cheater, so don't worry about that.

Mechanism:
When players use quick-turn, the difference between car's old angle and new angle is 90 degree.

Usage:
One callback is provided for this include to give users the full control of this include.

Code:
Only one function:

- OnPlayerQuickTurn(playerid, turntype)

Turntypes
1 - As a driver
2 - As a passenger
I RECOMMEND NOT TO USE KICK/BAN AS THIS INCLUDE IS IN INITIAL RELEASE.

Changelog:
Code:
V1.1
- Added types in the callback.
- Added a check if player uses quick turn while being as a passenger. (Type #2)
Download:
GitHub
Pastebin
Attachment
Attached Files
File Type: rar sQT V1.0.rar (681 Bytes, 5 views)
File Type: rar Anti quick turn v1.1.rar (889 Bytes, 5 views)
__________________

Last edited by StrikerZ; 08/03/2018 at 02:56 PM.
StrikerZ is offline   Reply With Quote
Old 02/03/2018, 03:40 PM   #2
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,170
Reputation: 351
Default Re: (sQt) Anti Quick-Turn

Very simple and effective, well done!

EDIT: I have an idea to detect passengers safely gonna submit a pull request on github,

I recommend everyone to use this, its pretty safe and actually works.

You just gotta hook the real results (as in setvehiclepos/zangle).
__________________

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link



Last edited by RogueDrifter; 06/04/2018 at 09:42 PM.
RogueDrifter is offline   Reply With Quote
Old 03/03/2018, 01:27 AM   #3
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,204
Reputation: 1242
Default Re: (sQt) Anti Quick-Turn

Why not do it like this?

Code:
#if defined sQt_Included
    #endinput
#endif

#define sQt_Included

#include <a_samp>

#define         MIN_ROT_VARIANCE        89.0
#define         MAX_ROT_VARIANCE        91.0

/*=================================================
*   Forwarding Hooks
===================================================*/
#if defined sQt_OnPlayerUpdate
forward sQt_OnPlayerUpdate(playerid);
#endif

#if defined sQt_OnPlayerStateChange
forward sQt_OnPlayerStateChange(playerid, newstate, oldstate);
#endif

#if defined OnPlayerQuickTurn
forward OnPlayerQuickTurn(playerid, infractions);
#endif

/*=================================================
*   Variable For Old Angle
===================================================*/
static Float:sQt_OldAngle[MAX_PLAYERS];
static sQt_Infractions[MAX_PLAYERS];

/*=================================================
*   Callbacks
===================================================*/
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new Float:z_rot;
        new vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleZAngle(vehicleid, sQt_OldAngle[playerid]);
    }
    #if defined sQt_OnPlayerStateChange
        return sQt_OnPlayerStateChange(playerid, newstate, oldstate);
    #else
        return 1;
    #endif
}

public OnPlayerUpdate(playerid)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new Float:z_rot;
        new vid = GetPlayerVehicleID(playerid);
        GetVehicleZAngle(vid, z_rot);

        if((sQt_OldAngle[playerid] - z_rot) <= MIN_ROT_VARIANCE || (sQt_OldAngle[playerid] - z_rot) >= MAX_ROT_VARIANCE)
        {
            sQt_Infractions[playerid]++;
            #if defined OnPlayerQuickTurn
            OnPlayerQuickTurn(playerid, sQt_Infractions[playerid]);
            #endif
        }
        sQt_OldAngle[playerid] = z_rot;
    }
    #if defined sQt_OnPlayerUpdate
        return sQt_OnPlayerUpdate(playerid);
    #else
        return 1;
    #endif
}

public OnPlayerDisconnect(playerid)
{
    sQt_Infractions[playerid] = 0;
    #if defined sQt_OnPlayerDisconnect
        return sQt_OnPlayerDisconnect(playerid);
    #else
        return 1;
    #endif

}


/*=================================================
*   Hooked Functions
===================================================*/
#if defined _ALS_OnPlayerStateChange
  #undef OnPlayerStateChange
#else
    #define _ALSOnPlayerStateChange
#endif

#define OnPlayerStateChange sQt_OnPlayerStateChange

#if defined _ALS_OnPlayerUpdate
  #undef OnPlayerUpdate
#else
    #define _ALS_OnPlayerUpdate
#endif

#define OnPlayerUpdate sQt_OnPlayerUpdate

#if defined _ALS_OnPlayerDisconnect
  #undef OnPlayerDisconnect
#else
    #define _ALS_OnPlayerDisconnect
#endif

#define OnPlayerDisconnect sQt_OnPlayerDisconnect
Pottus is offline   Reply With Quote
Old 03/03/2018, 04:03 AM   #4
StrikerZ
High-roller
 
StrikerZ's Avatar
 
Join Date: Mar 2016
Location: India
Posts: 1,104
Reputation: 154
Default Re: (sQt) Anti Quick-Turn

Quote:
Originally Posted by Pottus View Post
Why not do it like this?

Code:
#if defined sQt_Included
    #endinput
#endif

#define sQt_Included

#include <a_samp>

#define         MIN_ROT_VARIANCE        89.0
#define         MAX_ROT_VARIANCE        91.0

/*=================================================
*   Forwarding Hooks
===================================================*/
#if defined sQt_OnPlayerUpdate
forward sQt_OnPlayerUpdate(playerid);
#endif

#if defined sQt_OnPlayerStateChange
forward sQt_OnPlayerStateChange(playerid, newstate, oldstate);
#endif

#if defined OnPlayerQuickTurn
forward OnPlayerQuickTurn(playerid, infractions);
#endif

/*=================================================
*   Variable For Old Angle
===================================================*/
static Float:sQt_OldAngle[MAX_PLAYERS];
static sQt_Infractions[MAX_PLAYERS];

/*=================================================
*   Callbacks
===================================================*/
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new Float:z_rot;
        new vehicleid = GetPlayerVehicleID(playerid);
        GetVehicleZAngle(vehicleid, sQt_OldAngle[playerid]);
    }
    #if defined sQt_OnPlayerStateChange
        return sQt_OnPlayerStateChange(playerid, newstate, oldstate);
    #else
        return 1;
    #endif
}

public OnPlayerUpdate(playerid)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new Float:z_rot;
        new vid = GetPlayerVehicleID(playerid);
        GetVehicleZAngle(vid, z_rot);

        if((sQt_OldAngle[playerid] - z_rot) <= MIN_ROT_VARIANCE || (sQt_OldAngle[playerid] - z_rot) >= MAX_ROT_VARIANCE)
        {
            sQt_Infractions[playerid]++;
            #if defined OnPlayerQuickTurn
            OnPlayerQuickTurn(playerid, sQt_Infractions[playerid]);
            #endif
        }
        sQt_OldAngle[playerid] = z_rot;
    }
    #if defined sQt_OnPlayerUpdate
        return sQt_OnPlayerUpdate(playerid);
    #else
        return 1;
    #endif
}

public OnPlayerDisconnect(playerid)
{
    sQt_Infractions[playerid] = 0;
    #if defined sQt_OnPlayerDisconnect
        return sQt_OnPlayerDisconnect(playerid);
    #else
        return 1;
    #endif

}


/*=================================================
*   Hooked Functions
===================================================*/
#if defined _ALS_OnPlayerStateChange
  #undef OnPlayerStateChange
#else
    #define _ALSOnPlayerStateChange
#endif

#define OnPlayerStateChange sQt_OnPlayerStateChange

#if defined _ALS_OnPlayerUpdate
  #undef OnPlayerUpdate
#else
    #define _ALS_OnPlayerUpdate
#endif

#define OnPlayerUpdate sQt_OnPlayerUpdate

#if defined _ALS_OnPlayerDisconnect
  #undef OnPlayerDisconnect
#else
    #define _ALS_OnPlayerDisconnect
#endif

#define OnPlayerDisconnect sQt_OnPlayerDisconnect
I used the exact number for a reason. I have debugged the cheat and its exact 90 difference and moreover Rogue said that its better to use exact number cuz he said when player turns left angle goes from 0 to 360
__________________
StrikerZ is offline   Reply With Quote
Old 03/03/2018, 04:17 AM   #5
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,204
Reputation: 1242
Default Re: (sQt) Anti Quick-Turn

That is not a reason for anything. You have locked the script into a 1.0 degree range of setting off your detection.

http://wiki.sa-mp.com/wiki/Floatround_method

It makes absolutely no sense to use rounding at all for what you are doing.
Pottus is offline   Reply With Quote
Old 03/03/2018, 09:21 AM   #6
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,170
Reputation: 351
Default Re: (sQt) Anti Quick-Turn

Quote:
Originally Posted by StrikerZ View Post
I used the exact number for a reason. I have debugged the cheat and its exact 90 difference and moreover Rogue said that its better to use exact number cuz he said when player turns left angle goes from 0 to 360
His script will work because he blocked it between 89 and 91 but he missed the negative angle so it will counter the cheat but not always.

I hardly see a difference that would affect much between yours and his.
__________________

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Old 03/03/2018, 10:08 PM   #7
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,204
Reputation: 1242
Default Re: (sQt) Anti Quick-Turn

Quote:
Originally Posted by RogueDrifter View Post
His script will work because he blocked it between 89 and 91 but he missed the negative angle so it will counter the cheat but not always.

I hardly see a difference that would affect much between yours and his.
Well, why would you ever want to disregard precision? That is such a poor mentality. I equate that statement right away to "it's good enough" for me nothing is ever good enough. Sure I talk shit to you guys! I know it but I talk the same shit to myself constantly.

I will talk some more shit that is..... neither of you guys have proven shit to me beyond you are both probably capable of taking your work to the extreme.

The sooner you guys stop making these petty bullshit releases and go for the gold I won't be fully impressed until that time.
Pottus is offline   Reply With Quote
Old 04/03/2018, 02:14 AM   #8
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,170
Reputation: 351
Default Re: (sQt) Anti Quick-Turn

Quote:
Originally Posted by Pottus View Post
Well, why would you ever want to disregard precision? That is such a poor mentality. I equate that statement right away to "it's good enough" for me nothing is ever good enough. Sure I talk shit to you guys! I know it but I talk the same shit to myself constantly.

I will talk some more shit that is..... neither of you guys have proven shit to me beyond you are both probably capable of taking your work to the extreme.

The sooner you guys stop making these petty bullshit releases and go for the gold I won't be fully impressed until that time.
Whoa, i was giving you an advice, you missed the negative angle! your suggestion won't always work, take time to read. I don't really go around releasing things to impress anyone...
Quote:
Originally Posted by Pottus
petty bullshit releases and go for the gold
Why call someone's hard work petty bullshit? moreover how is this going for the gold? how is this 'gold' in any matter? name one thing anyone gets out of this?

Not the perfect way to show your pov on anything tbh, but hey that's like totally your opinion mate, tho, that's not what i'd call creative criticism at all, you provided an incomplete code (missed the -90 angle) which also has no explanation i don't see how that'll help anyone.

I don't understand how is this not accurate or not precise, you only gave range for the angle 89 to 91 which won't even matter, it's checked for at OPU, the moment a quickturn happens (old-new = 90) it will get detected...

I'll be speaking for myself, all i ever done since i joined here was provide material that i thought would be helpful and i maintained it to provide decent standard projects that were never provided before and held, everything is abandoned, hardly anyone cares but yet here you are picking on the ones who do.
__________________

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Old 04/03/2018, 03:25 AM   #9
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,204
Reputation: 1242
Default Re: (sQt) Anti Quick-Turn

I'm just trying to push you guys to do better. That is all and I made a mistake there but an easy fix and I was well aware of that I just didn't address it at all. I don't know why I have to be such a prick
Pottus is offline   Reply With Quote
Old 04/03/2018, 03:40 AM   #10
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,170
Reputation: 351
Default Re: (sQt) Anti Quick-Turn

Quote:
Originally Posted by Pottus View Post
I'm just trying to push you guys to do better. That is all and I made a mistake there but an easy fix and I was well aware of that I just didn't address it at all. I don't know why I have to be such a prick
Ah well lol, i'm improving myself and i'm sure striker will as well, i keep updating as u can see and soon it'll be perfect, thanks for the share.
__________________

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


RogueDrifter is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick anti cheats GrOobY Scripting Help 3 06/05/2014 08:03 PM
[Include] Anti Quick ReConnect White_116 Релизы/Releases 11 10/02/2014 11:13 AM
[FilterScript] Anti Quick Reconnect MX_Master Релизы/Releases 41 25/07/2010 08:58 PM
anti cheat - 180* turn - help StrickenKid Help Archive 16 20/04/2009 03:57 PM
Turn off anti-cheat hypnoticweener Help Archive 3 21/02/2009 07:01 AM


All times are GMT. The time now is 09:29 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.