Code:
#include <sourcemod>
#include <sdktools>
public Plugin:myinfo =
{
name = "SpinHack Detectir",
author = "SAMURAI",
description = "catch spinhack",
version = "1.0",
url = "www.cs-utilz.net"
}
#define MaxAngelChange 1500
#define MAX_DETECTIONS 25
#define PLAYER_LEFT 128 // Player is holdign down the left button
#define PLAYER_RIGHT 256 // Player is holdign down the right button
new Float:gf_LastAng[MAXPLAYERS+1][3];
new Float:gf_TotalAng[MAXPLAYERS+1];
new g_Detections[MAXPLAYERS+1] ;
new g_iMaxClients;
public OnPluginStart()
{
g_iMaxClients = GetMaxClients();
CreateTimer(1.0,check_for_spinhack,_,TIMER_REPEAT);
CreateTimer(0.1,FakePrethink,0,TIMER_REPEAT);
}
public Action:check_for_spinhack(Handle:timer)
{
for(new i = 1; i <= g_iMaxClients; i++)
{
if(IsPlayerAlive(i))
{
if(gf_TotalAng[i] >= MaxAngelChange)
{
if(g_Detections[i] >= MAX_DETECTIONS)
{
RegisterOffense(i);
}
g_Detections[i]++;
}
else
g_Detections[i] = 0;
gf_TotalAng[i] = 0.0;
}
}
}
public Action:FakePrethink(Handle:timer)
{
for(new i = 1; i<= g_iMaxClients; i++)
{
if(IsPlayerAlive(i))
{
decl Float:Angle[3];
GetClientAbsAngles(i,Angle);
gf_TotalAng[i] += GetVectorDistance(gf_LastAng[i],Angle);
CopyVector(Angle,gf_LastAng[i])
new button = GetClientButtons(i);
if(button & PLAYER_LEFT || button & PLAYER_RIGHT)
{
g_Detections[i] = 0;
}
}
}
}
stock RegisterOffense(client)
{
BanClient(client,0,BANFLAG_IP,"SpinHack Detected !","SpinHack Detected",_);
}
stock CopyVector(Float:Vec1[3],Float:Vec2[3])
{
Vec2[0] = Vec1[0];
Vec2[1] = Vec1[1];
Vec2[2] = Vec1[2];
}
Just porting EKS's plugin