Raised This Month: $51 Target: $400
 12% 

[ANY/CS:GO] Backtrack Elimination (1.2)


Post New Thread Reply   
 
Thread Tools Display Modes
xFlane
AlliedModders Donor
Join Date: Nov 2017
Location: Israel
Old 04-13-2018 , 06:10   Re: [ANY/CS:GO] Backtrack Elimination (1.2)
Reply With Quote #11

Wow, great job shavit.
You could optimize the use of the plugin by deleting the old ticks that cant be used,
but i am not sure if it will still be able to block the backtracking exploit ( i can't check this one ).

PHP Code:
#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION "1.2"

ConVar gCV_Behavior null;

ArrayList gA_TickCounts[MAXPLAYERS+1];

public 
Plugin myinfo =
{
    
name "Backtrack Elimination",
    
author "shavit",
    
description "Fixes the 'backtrack' exploit.",
    
version PLUGIN_VERSION,
    
url "https://github.com/shavitush"
}

int DeadTick 0;

public 
void OnPluginStart()
{
    
CreateConVar("backtrack_version"PLUGIN_VERSION"Plugin version.", (FCVAR_NOTIFY FCVAR_DONTRECORD));
    
gCV_Behavior CreateConVar("backtrack_behavior""1""Should the plugin be enabled?\n0 - no\n1 - yes, eliminate backtracking"0true0.0true1.0);

    
AutoExecConfig();

    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i))
        {
            
OnClientPutInServer(i);
        }
    }

    
DeadTick RoundToZero((1.0 GetTickInterval()) * FindConVar("sv_maxunlag").FloatValue); // server tickrate * sv_maxunlag value.
    
HookEvent("player_spawn"Player_Spawn);
}

public 
void Player_Spawn(Event event, const char[] namebool dontBroadcast)
{
    
int userid event.GetInt("userid");
    
int client GetClientOfUserId(userid);

    if(
gA_TickCounts[client] != null)
    {
        
gA_TickCounts[client].Clear();
    }
}

public 
void OnClientPutInServer(int client)
{
    if(!
IsFakeClient(client) && gA_TickCounts[client] == null)
    {
        
gA_TickCounts[client] = new ArrayList();
    }
}

public 
void OnClientDisconnect(int client)
{
    
delete gA_TickCounts[client];
}

public 
Action OnPlayerRunCmd(int clientint &buttonsint &impulsefloat vel[3], float angles[3], int &weaponint &subtypeint &cmdnumint &tickcount)
{
    if(!
IsPlayerAlive(client) || IsFakeClient(client) || !gCV_Behavior.BoolValue || gA_TickCounts[client] == null)
    {
        return 
Plugin_Continue;
    }

    if(
gA_TickCounts[client].FindValue(tickcount) == -1)
    {
        
gA_TickCounts[client].Push(tickcount);
        if(
gA_TickCounts[client].Length DeadTick)
        {
            
gA_TickCounts[client].Erase(0);
        }
    }

    
// illegal usercmd->tick_count
    // you cannot have the same tick_count twice!
    
else
    {
        
// makes the exploit useless by editing tick_count to a random value, below the possible window for backtracking
        
SortADTArray(gA_TickCounts[client], Sort_DescendingSort_Integer);
        
tickcount gA_TickCounts[client].Get(0) - GetRandomInt(3264);
        
        
// prevent duplicates
        
if(gA_TickCounts[client].FindValue(tickcount) == -1)
        {
            
gA_TickCounts[client].Push(tickcount);
        }
        if(
gA_TickCounts[client].Length DeadTick)
        {
            
gA_TickCounts[client].Erase(0);
        }
        
        return 
Plugin_Changed;
    }

    return 
Plugin_Continue;

__________________
Taking private requests.
xFlane is offline
Blue Malgeran
Junior Member
Join Date: Apr 2017
Location: Israel
Old 04-13-2018 , 07:56   Re: [ANY/CS:GO] Backtrack Elimination (1.2)
Reply With Quote #12

Good job!
__________________
Blue Malgeran is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 04-13-2018 , 13:14   Re: [ANY/CS:GO] Backtrack Elimination (1.2)
Reply With Quote #13

Quote:
Originally Posted by xFlane View Post
Wow, great job shavit.
You could optimize the use of the plugin by deleting the old ticks that cant be used,
but i am not sure if it will still be able to block the backtracking exploit ( i can't check this one ).

PHP Code:
#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION "1.2"

ConVar gCV_Behavior null;

ArrayList gA_TickCounts[MAXPLAYERS+1];

public 
Plugin myinfo =
{
    
name "Backtrack Elimination",
    
author "shavit",
    
description "Fixes the 'backtrack' exploit.",
    
version PLUGIN_VERSION,
    
url "https://github.com/shavitush"
}

int DeadTick 0;

public 
void OnPluginStart()
{
    
CreateConVar("backtrack_version"PLUGIN_VERSION"Plugin version.", (FCVAR_NOTIFY FCVAR_DONTRECORD));
    
gCV_Behavior CreateConVar("backtrack_behavior""1""Should the plugin be enabled?\n0 - no\n1 - yes, eliminate backtracking"0true0.0true1.0);

    
AutoExecConfig();

    for(
int i 1<= MaxClientsi++)
    {
        if(
IsClientInGame(i))
        {
            
OnClientPutInServer(i);
        }
    }

    
DeadTick RoundToZero((1.0 GetTickInterval()) * FindConVar("sv_maxunlag").FloatValue); // server tickrate * sv_maxunlag value.
    
HookEvent("player_spawn"Player_Spawn);
}

public 
void Player_Spawn(Event event, const char[] namebool dontBroadcast)
{
    
int userid event.GetInt("userid");
    
int client GetClientOfUserId(userid);

    if(
gA_TickCounts[client] != null)
    {
        
gA_TickCounts[client].Clear();
    }
}

public 
void OnClientPutInServer(int client)
{
    if(!
IsFakeClient(client) && gA_TickCounts[client] == null)
    {
        
gA_TickCounts[client] = new ArrayList();
    }
}

public 
void OnClientDisconnect(int client)
{
    
delete gA_TickCounts[client];
}

public 
Action OnPlayerRunCmd(int clientint &buttonsint &impulsefloat vel[3], float angles[3], int &weaponint &subtypeint &cmdnumint &tickcount)
{
    if(!
IsPlayerAlive(client) || IsFakeClient(client) || !gCV_Behavior.BoolValue || gA_TickCounts[client] == null)
    {
        return 
Plugin_Continue;
    }

    if(
gA_TickCounts[client].FindValue(tickcount) == -1)
    {
        
gA_TickCounts[client].Push(tickcount);
        if(
gA_TickCounts[client].Length DeadTick)
        {
            
gA_TickCounts[client].Erase(0);
        }
    }

    
// illegal usercmd->tick_count
    // you cannot have the same tick_count twice!
    
else
    {
        
// makes the exploit useless by editing tick_count to a random value, below the possible window for backtracking
        
SortADTArray(gA_TickCounts[client], Sort_DescendingSort_Integer);
        
tickcount gA_TickCounts[client].Get(0) - GetRandomInt(3264);
        
        
// prevent duplicates
        
if(gA_TickCounts[client].FindValue(tickcount) == -1)
        {
            
gA_TickCounts[client].Push(tickcount);
        }
        if(
gA_TickCounts[client].Length DeadTick)
        {
            
gA_TickCounts[client].Erase(0);
        }
        
        return 
Plugin_Changed;
    }

    return 
Plugin_Continue;

I don't think this is how lag compensation works. https://mxr.alliedmods.net/hl2sdk-cs...?i=sv_maxunlag
Refer to the references in game/server/player.cpp and game/server/player_lagcompensation.cpp. Although this is from AM's reversed SDK, I believe it's still accurate.

This micro-optimization seems very unnecessary (and to be honest, it causes more overhead!) as you do more calls to ArrayList.Length and ArrayList.Erase. Keep in mind that ADT arrays are very fast too.
__________________
retired

Last edited by shavit; 04-13-2018 at 13:18.
shavit is offline
Zyten
Senior Member
Join Date: Jan 2018
Old 04-13-2018 , 18:45   Re: [ANY/CS:GO] Backtrack Elimination (1.2)
Reply With Quote #14

https://forums.alliedmods.net/showthread.php?t=300364
could u add vip features to this plugins atleast the 1st ones

Custom Chat Tag
Tag Color
Name Color
Chat Color
Zyten is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 04-13-2018 , 20:27   Re: [ANY/CS:GO] Backtrack Elimination (1.2)
Reply With Quote #15

Quote:
Originally Posted by Zyten View Post
https://forums.alliedmods.net/showthread.php?t=300364
could u add vip features to this plugins atleast the 1st ones

Custom Chat Tag
Tag Color
Name Color
Chat Color
I have no idea how this is even relevant to Backtrack Elimination.
__________________
retired
shavit is offline
Lubricant Jam
AlliedModders Donor
Join Date: Oct 2016
Location: United Kingdom
Old 04-14-2018 , 09:29   Re: [ANY/CS:GO] Backtrack Elimination (1.2)
Reply With Quote #16

Still getting issues of people freezing in 1v1 arenas.
Lubricant Jam is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 20:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode