-
Notifications
You must be signed in to change notification settings - Fork 2
/
shavit-cash.sp
213 lines (168 loc) · 6.21 KB
/
shavit-cash.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#include <sourcemod>
#include <shavit>
#define MAX_IMPOSSIBLE 30
//#define DEBUG
#pragma semicolon 1
int CASH_ImpossibleMovements[MAXPLAYERS + 1];
int CASH_NotificationCount[MAXPLAYERS + 1];
int CASH_PerfectOnground[MAXPLAYERS + 1];
int CASH_LastMovement[MAXPLAYERS + 1];
char PLUGIN_LOGFILE[PLATFORM_MAX_PATH];
ConVar Cvar_Bans_Enabled;
ConVar Cvar_Bans_Amount;
ConVar Cvar_Bans_Length;
ConVar Cvar_Bans_ServerURL;
ConVar Cvar_EnableAntiStrafe;
Handle g_hTimer;
EngineVersion gEV_Game;
public Plugin myinfo = {
name = "[shavit] CASH",
description = "cam anti-strafe-hack",
author = "cam",
version = "2001-0.3",
url = "www.strafeodyssey.com"
};
public void OnPluginStart(){
gEV_Game = GetEngineVersion();
Cvar_Bans_Enabled = CreateConVar("timer_cash_bans_enabled", "0", "Enables or disables automatic bans", _, true, 0.0, true, 1.0);
Cvar_Bans_Amount = CreateConVar("timer_cash_bans_amount", "10", "If bans are enabled, determines how many CASH notifications before automatic ban (during one map)", _, true, 5.0, true, 30.0);
Cvar_Bans_Length = CreateConVar("timer_cash_bans_length", "0", "If bans are enabled, determines how long automatic bans should be (in minutes)", _, true, 0.0, false);
Cvar_Bans_ServerURL = CreateConVar("timer_cash_bans_url", "", "Set the link to display in the kick message");
Cvar_EnableAntiStrafe = CreateConVar("timer_cash_enable_antistrafe", "1", "READ CAREFULLY - With this enabled, it will block out many more cheats. HOWEVER. It will also detect people using +strafe. Use at own risk.");
AutoExecConfig(true, "cash", "timer");
BuildPath(Path_SM, PLUGIN_LOGFILE, PLATFORM_MAX_PATH, "logs/shavit-CASH.txt");
}
public void OnMapStart(){
for(int client = 1; client <= MaxClients; client++){
if(IsClientConnected(client) && IsClientInGame(client) && !IsFakeClient(client)){
CASH_ImpossibleMovements[client] = 0;
CASH_NotificationCount[client] = 0;
}
}
g_hTimer = CreateTimer(10.0, CASH_TimerCheck, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
}
public void OnMapEnd(){
for(int client = 1; client <= MaxClients; client++){
if(IsClientConnected(client) && IsClientInGame(client) && !IsFakeClient(client)){
CASH_ImpossibleMovements[client] = 0;
CASH_NotificationCount[client] = 0;
}
}
if(g_hTimer != INVALID_HANDLE)
KillTimer(g_hTimer);
}
public void OnClientPutInServer(int client){
CASH_ImpossibleMovements[client] = 0;
CASH_NotificationCount[client] = 0;
}
public Action CASH_TimerCheck(Handle timer, any data){
for(int client = 1; client <= MaxClients; client++){
if(IsClientConnected(client) && IsClientInGame(client) && !IsFakeClient(client)){
if(CASH_ImpossibleMovements[client] > MAX_IMPOSSIBLE)
CASH_SuspectPlayer(client);
}
}
return Plugin_Handled;
}
void CASH_SuspectPlayer(int client){
if((!IsClientConnected(client)) || (!IsClientInGame(client)))
return;
char sSpecial[128];
int style = Shavit_GetBhopStyle(client);
Shavit_GetStyleStrings(style, sSpecialString, sSpecial, 128);
if(StrContains(sSpecial, "cash_bypass", false) != -1)
return;
char Log_Message[256];
char clientIP[64];
GetClientIP(client, clientIP, sizeof(clientIP));
FormatEx(Log_Message, sizeof(Log_Message), "[CASH] Player %L [%s] made over 30 impossible movements in 10s! (impossible: %i)\n",
client,
clientIP,
CASH_ImpossibleMovements[client]);
LogToFile(PLUGIN_LOGFILE, Log_Message);
for(int adminclient = 1; adminclient <= MaxClients; adminclient++){
if(IsClientInGame(adminclient) && GetAdminFlag(GetUserAdmin(adminclient), Admin_Root, Access_Effective)){
PrintToChat(client, "[CASH] Player %N has set off CASH. Check console.", client);
PrintToConsole(client, Log_Message);
}
}
CASH_ImpossibleMovements[client] = 0;
CASH_NotificationCount[client]++;
DoAutomaticBans();
}
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon){
char sSpecial[128];
int style = Shavit_GetBhopStyle(client);
Shavit_GetStyleStrings(style, sSpecialString, sSpecial, 128);
if(StrContains(sSpecial, "cash_bypass", false) != -1)
return;
if(client != 0 && IsClientConnected(client) && IsClientInGame(client) && IsPlayerAlive(client) && !IsFakeClient(client)){
if(Cvar_EnableAntiStrafe.BoolValue){
if(RoundFloat(vel[0]) % 25 != 0.0)
CASH_ImpossibleMovements[client]++;
if(RoundFloat(vel[1]) % 25 != 0.0)
CASH_ImpossibleMovements[client]++;
}
if(gEV_Game == Engine_CSS){
if(vel[1] > 0)
vel[1] = 400.0;
else if(vel[1] < 0)
vel[1] = -400.0;
if(vel[0] > 0)
vel[0] = 400.0;
else if(vel[0] < 0)
vel[0] = -400.0;
}
else if(gEV_Game == Engine_CSGO){
if(vel[1] > 0)
vel[1] = 450.0;
else if(vel[1] < 0)
vel[1] = -450.0;
if(vel[0] > 0)
vel[0] = 450.0;
else if(vel[0] < 0)
vel[0] = -450.0;
}
else{
SetFailState("This plugin is for CSGO/CSS only.");
}
if(vel[1] < 0)
{
if(CASH_LastMovement[client] == IN_MOVELEFT){
CASH_PerfectOnground[client]++;
}
else
{
CASH_PerfectOnground[client] = 0;
}
CASH_LastMovement[client] = IN_MOVERIGHT;
}
if(vel[1] > 0)
{
if(CASH_LastMovement[client] == IN_MOVERIGHT){
CASH_PerfectOnground[client]++;
}
else
{
CASH_PerfectOnground[client] = 0;
}
CASH_LastMovement[client] = IN_MOVELEFT;
}
}
}
void DoAutomaticBans(){
char cSteamID[32];
char server_website[64];
if(Cvar_Bans_Enabled.BoolValue || Cvar_Bans_Enabled.IntValue > 0 || Cvar_Bans_Enabled.FloatValue > 0.0){
Cvar_Bans_ServerURL.GetString(server_website, sizeof(server_website));
for(int client = 1; client <= MaxClients; client++){
if(IsClientConnected(client) && IsClientInGame(client) && CASH_NotificationCount[client] > 0){
if(CASH_NotificationCount[client] > Cvar_Bans_Amount.IntValue || CASH_NotificationCount[client] > Cvar_Bans_Amount.FloatValue){
GetClientAuthId(client, AuthId_Steam2, cSteamID, sizeof(cSteamID));
ServerCommand("sm_addban %d %s [CASH] Automated ban", Cvar_Bans_Length.IntValue, cSteamID);
KickClient(client, "[CASH] Automated ban, check %s for more info.", server_website);
}
}
}
}
}