View Single Post
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 11-29-2020 , 06:42   Re: [L4D2] Airstuck teleportation patch
Reply With Quote #8

Added log to file.

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

#pragma newdecls required

#define IS_NAN(%1) ( (%1) != (%1) )

char path[256];

public Plugin myinfo = 
{
	name = "Airstuck detection",
	author = "BHaType",
	description = "Detect cheaters who use airstuck exploit.",
	version = "1.0",
	url = "https://forums.alliedmods.net/showpost.php?p=2726146&postcount=5"
};

public void OnPluginStart()
{
	BuildPath(Path_SM, path, 256, "logs/airstuck.txt");
	
	HookEvent("player_connect_full", Event_PlayerConnect);
}

public void Event_PlayerConnect(Event event, const char[] name, bool dontBroadcast)
{
	int client = GetClientOfUserId(event.GetInt("userid"));

	if (client == 0 || !IsClientInGame(client) || IsFakeClient(client)) return;
}

public Action OnPlayerRunCmd (int client, int &buttons, int &impulse, float vel[3], float angles[3], int& weapon, int &subtype, int &cmdnum, int &tickcount, int &seed)
{
    if ( IsFakeClient(client) )
        return;
    
    if ( IS_NAN(vel[0]) || IS_NAN(angles[0]) ) 
    {
        char SteamID[32];
        GetClientAuthId(client, AuthId_Steam2, SteamID, sizeof(SteamID));
        
        LogToFile(path, ".:[Name: %N | STEAMID: %s  is suspected of using airstuck cheat.]:.", client, SteamID);
        LogMessage("%N is suspected of using airstuck (NAN value!!)", client);
    }
}

Last edited by JLmelenchon; 11-30-2020 at 06:53.
JLmelenchon is offline