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);
}
}