15
15
// You should have received a copy of the GNU General Public License
16
16
// along with SourceBans++. If not, see <http://www.gnu.org/licenses/>.
17
17
//
18
- // This file incorporates work covered by the following copyright(s):
18
+ // This file is based off work covered by the following copyright(s):
19
19
//
20
20
// SourceSleuth 1.3 fix
21
21
// Copyright (C) 2013-2015 ecca
24
24
//
25
25
// *************************************************************************
26
26
27
+ /* !SOMEONE PLEASE FIX THIS BROKEN ASS PLUGIN! */
28
+
27
29
#pragma semicolon 1
28
30
#include <sourcemod>
29
31
#undef REQUIRE_PLUGIN
30
32
#include <sourcebans>
31
33
32
- #define PLUGIN_VERSION " (SB++) 1.5.4.4 "
34
+ #define PLUGIN_VERSION " (SB++) 1.5.4.5 "
33
35
34
36
#define LENGTH_ORIGINAL 1
35
37
#define LENGTH_CUSTOM 2
@@ -53,18 +55,18 @@ new bool:CanUseSourcebans = false;
53
55
54
56
public Plugin :myinfo =
55
57
{
56
- name = " SourceSleuth" ,
57
- author = " ecca, Sarabveer(VEER™)" ,
58
- description = " Useful for TF2 servers. Plugin will check for banned ips and ban the player." ,
59
- version = PLUGIN_VERSION ,
60
- url = " http ://sourcemod.net "
58
+ name = " SourceSleuth" ,
59
+ author = " ecca, Sarabveer(VEER™)" ,
60
+ description = " Useful for TF2 servers. Plugin will check for banned ips and ban the player." ,
61
+ version = PLUGIN_VERSION ,
62
+ url = " https ://sarabveer.github.io/SourceBans-Fork/ "
61
63
};
62
64
63
65
public OnPluginStart ()
64
66
{
65
67
LoadTranslations (" sourcesleuth.phrases" );
66
68
67
- CreateConVar (" sm_sourcesleuth_version" , PLUGIN_VERSION , " SourceSleuth plugin version" , FCVAR_PLUGIN | FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY | FCVAR_DONTRECORD );
69
+ CreateConVar (" sm_sourcesleuth_version" , PLUGIN_VERSION , " SourceSleuth plugin version" , FCVAR_PLUGIN | FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY | FCVAR_DONTRECORD );
68
70
69
71
g_cVar_actions = CreateConVar (" sm_sleuth_actions" , " 3" , " Sleuth Ban Type: 1 - Original Length, 2 - Custom Length, 3 - Double Length, 4 - Notify Admins Only" , FCVAR_PLUGIN , true , 1.0 , true , 4.0 );
70
72
g_cVar_banduration = CreateConVar (" sm_sleuth_duration" , " 0" , " Required: sm_sleuth_actions 1: Bantime to ban player if we got a match (0 = permanent (defined in minutes) )" , FCVAR_PLUGIN );
@@ -76,7 +78,7 @@ public OnPluginStart()
76
78
g_hAllowedArray = CreateArray (256 );
77
79
78
80
AutoExecConfig (true , " Sm_SourceSleuth" );
79
-
81
+
80
82
SQL_TConnect (SQL_OnConnect , " sourcebans" );
81
83
82
84
RegAdminCmd (" sm_sleuth_reloadlist" , ReloadListCallBack , ADMFLAG_ROOT );
@@ -110,10 +112,10 @@ public SQL_OnConnect(Handle:owner, Handle:hndl, const String:error[], any:data)
110
112
if (hndl == INVALID_HANDLE )
111
113
{
112
114
LogError (" SourceSleuth: Database connection error: %s " , error );
113
- }
114
- else
115
+ }
116
+ else
115
117
{
116
- hDatabase = hndl ;
118
+ hDatabase = hndl ;
117
119
}
118
120
}
119
121
@@ -125,7 +127,7 @@ public Action:ReloadListCallBack(client, args)
125
127
126
128
LogMessage (" %L reloaded the whitelist" , client );
127
129
128
- if (client != 0 )
130
+ if (client != 0 )
129
131
{
130
132
PrintToChat (client , " [SourceSleuth] WhiteList has been reloaded!" );
131
133
}
@@ -135,17 +137,17 @@ public Action:ReloadListCallBack(client, args)
135
137
136
138
public OnClientPostAdminCheck (client )
137
139
{
138
- if (CanUseSourcebans && ! IsFakeClient (client ))
140
+ if (CanUseSourcebans && ! IsFakeClient (client ))
139
141
{
140
142
new String :steamid [32 ];
141
143
GetClientAuthId (client , AuthId_Steam2 , steamid , sizeof (steamid ));
142
144
143
- if (g_cVar_bypass .BoolValue && CheckCommandAccess (client , " sleuth_admin" , ADMFLAG_BAN , false ))
145
+ if (g_cVar_bypass .BoolValue && CheckCommandAccess (client , " sleuth_admin" , ADMFLAG_BAN , false ))
144
146
{
145
147
return ;
146
148
}
147
149
148
- if (FindStringInArray (g_hAllowedArray , steamid ) == - 1 )
150
+ if (FindStringInArray (g_hAllowedArray , steamid ) == - 1 )
149
151
{
150
152
new String :IP [32 ], String :Prefix [64 ];
151
153
GetClientIP (client , IP , sizeof (IP ));
@@ -154,10 +156,10 @@ public OnClientPostAdminCheck(client)
154
156
155
157
new String :query [1024 ];
156
158
157
- FormatEx (query , sizeof (query ), " SELECT * FROM %s _bans WHERE ip='%s ' AND RemoveType IS NULL AND ends > %d " , Prefix , IP , g_cVar_bantype .IntValue == 0 ? GetTime () : 0 );
158
-
159
+ FormatEx (query , sizeof (query ), " SELECT * FROM %s _bans WHERE ip='%s ' AND RemoveType IS NULL AND ends > %d " , Prefix , IP , g_cVar_bantype .IntValue == 0 ? GetTime () : 0 );
160
+
159
161
new Handle :datapack = CreateDataPack ();
160
-
162
+
161
163
WritePackCell (datapack , GetClientUserId (client ));
162
164
WritePackString (datapack , steamid );
163
165
WritePackString (datapack , IP );
@@ -173,12 +175,12 @@ public SQL_CheckHim(Handle:owner, Handle:hndl, const String:error[], any:datapac
173
175
new client ;
174
176
decl String :steamid [32 ], String :IP [32 ];
175
177
176
- if (datapack != INVALID_HANDLE )
178
+ if (datapack != INVALID_HANDLE )
177
179
{
178
180
client = GetClientOfUserId (ReadPackCell (datapack ));
179
181
ReadPackString (datapack , steamid , sizeof (steamid ));
180
182
ReadPackString (datapack , IP , sizeof (IP ));
181
- CloseHandle (datapack );
183
+ CloseHandle (datapack );
182
184
}
183
185
184
186
if (hndl == INVALID_HANDLE )
@@ -191,14 +193,14 @@ public SQL_CheckHim(Handle:owner, Handle:hndl, const String:error[], any:datapac
191
193
{
192
194
new TotalBans = SQL_GetRowCount (hndl );
193
195
194
- if (TotalBans > g_cVar_bansAllowed .IntValue )
196
+ if (TotalBans > g_cVar_bansAllowed .IntValue )
195
197
{
196
198
switch (g_cVar_actions .IntValue )
197
199
{
198
200
case LENGTH_ORIGINAL :
199
201
{
200
202
new length = SQL_FetchInt (hndl , 6 );
201
- new time = length * 60 ;
203
+ new time = length * 60 ;
202
204
203
205
BanPlayer (client , time );
204
206
}
@@ -210,14 +212,14 @@ public SQL_CheckHim(Handle:owner, Handle:hndl, const String:error[], any:datapac
210
212
case LENGTH_DOUBLE :
211
213
{
212
214
new length = SQL_FetchInt (hndl , 6 );
213
- new time = length / 60 * 2 ;
214
-
215
+ new time = length / 60 * 2 ;
216
+
215
217
BanPlayer (client , time );
216
218
}
217
219
case LENGTH_NOTIFY :
218
220
{
219
221
/* Notify Admins when a client with an ip on the bans list connects */
220
- PrintToAdmins (" [SourceSleuth] %t " , " sourcesleuth_admintext" ,client , steamid , IP );
222
+ PrintToAdmins (" [SourceSleuth] %t " , " sourcesleuth_admintext" , client , steamid , IP );
221
223
}
222
224
}
223
225
}
@@ -235,7 +237,7 @@ PrintToAdmins(const String:format[], any:...)
235
237
{
236
238
new String :g_Buffer [256 ];
237
239
238
- for (new i = 1 ; i <= MaxClients ;i ++ )
240
+ for (new i = 1 ; i <= MaxClients ; i ++ )
239
241
{
240
242
if (CheckCommandAccess (i , " sm_sourcesleuth_printtoadmins" , ADMFLAG_BAN ) && IsClientInGame (i ))
241
243
{
@@ -249,17 +251,17 @@ PrintToAdmins(const String:format[], any:...)
249
251
public LoadWhiteList ()
250
252
{
251
253
decl String :path [PLATFORM_MAX_PATH ], String :line [256 ];
252
-
254
+
253
255
BuildPath (Path_SM , path , PLATFORM_MAX_PATH , " configs/sourcesleuth_whitelist.cfg" );
254
-
256
+
255
257
new Handle :fileHandle = OpenFile (path , " r" );
256
-
257
- while (! IsEndOfFile (fileHandle ) && ReadFileLine (fileHandle , line , sizeof (line )))
258
+
259
+ while (! IsEndOfFile (fileHandle ) && ReadFileLine (fileHandle , line , sizeof (line )))
258
260
{
259
- ReplaceString (line , sizeof (line ), " \n " , " " , false );
260
-
261
+ ReplaceString (line , sizeof (line ), " \n " , " " , false );
262
+
261
263
PushArrayString (g_hAllowedArray , line );
262
264
}
263
-
265
+
264
266
CloseHandle (fileHandle );
265
267
}
0 commit comments