Skip to content

Commit

Permalink
1.5.4.3
Browse files Browse the repository at this point in the history
Added ULX Gmod Module
Downgrade SM Plugin to 1.5.3
  • Loading branch information
sarabveer committed Mar 25, 2016
1 parent 0f39533 commit f9f19c1
Show file tree
Hide file tree
Showing 17 changed files with 3,802 additions and 3,280 deletions.
Binary file modified game_upload/addons/sourcemod/plugins/SourceSleuth.smx
Binary file not shown.
Binary file modified game_upload/addons/sourcemod/plugins/sb_admcfg.smx
Binary file not shown.
Binary file modified game_upload/addons/sourcemod/plugins/sbchecker.smx
Binary file not shown.
Binary file modified game_upload/addons/sourcemod/plugins/sourcebans.smx
Binary file not shown.
Binary file modified game_upload/addons/sourcemod/plugins/sourcecomms.smx
Binary file not shown.
86 changes: 39 additions & 47 deletions game_upload/addons/sourcemod/scripting/SourceSleuth.sp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#undef REQUIRE_PLUGIN
#include <sourcebans>

#define PLUGIN_VERSION "(SB++) 1.5.4.2"
#define PLUGIN_VERSION "(SB++) 1.5.4.3"

#define LENGTH_ORIGINAL 1
#define LENGTH_CUSTOM 2
Expand All @@ -53,18 +53,18 @@ new bool:CanUseSourcebans = false;

public Plugin:myinfo =
{
name = "SourceSleuth",
author = "ecca, Sarabveer(VEER™)",
description = "Useful for TF2 servers. Plugin will check for banned ips and ban the player.",
version = PLUGIN_VERSION,
url = "http://sourcemod.net"
name = "SourceSleuth",
author = "ecca, Sarabveer(VEER™)",
description= "Useful for TF2 servers. Plugin will check for banned ips and ban the player.",
version = PLUGIN_VERSION,
url = "http://sourcemod.net"
};

public OnPluginStart()
{
LoadTranslations("sourcesleuth.phrases");

CreateConVar("sm_sourcesleuth_version", PLUGIN_VERSION, "SourceSleuth plugin version", FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY | FCVAR_DONTRECORD);
CreateConVar("sm_sourcesleuth_version", PLUGIN_VERSION, "SourceSleuth plugin version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);

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);
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);
Expand All @@ -76,7 +76,7 @@ public OnPluginStart()
g_hAllowedArray = CreateArray(256);

AutoExecConfig(true, "Sm_SourceSleuth");

SQL_TConnect(SQL_OnConnect, "sourcebans");

RegAdminCmd("sm_sleuth_reloadlist", ReloadListCallBack, ADMFLAG_ROOT);
Expand Down Expand Up @@ -110,10 +110,10 @@ public SQL_OnConnect(Handle:owner, Handle:hndl, const String:error[], any:data)
if (hndl == INVALID_HANDLE)
{
LogError("SourceSleuth: Database connection error: %s", error);
}
else
}
else
{
hDatabase = hndl;
hDatabase = hndl;
}
}

Expand All @@ -125,7 +125,7 @@ public Action:ReloadListCallBack(client, args)

LogMessage("%L reloaded the whitelist", client);

if (client != 0)
if(client != 0)
{
PrintToChat(client, "[SourceSleuth] WhiteList has been reloaded!");
}
Expand All @@ -135,29 +135,29 @@ public Action:ReloadListCallBack(client, args)

public OnClientPostAdminCheck(client)
{
if (CanUseSourcebans && !IsFakeClient(client))
if(CanUseSourcebans && !IsFakeClient(client))
{
decl String:steamid[32];
new String:steamid[32];
GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid));

if (g_cVar_bypass.BoolValue && CheckCommandAccess(client, "sleuth_admin", ADMFLAG_BAN, false))
if (g_cVar_bypass.BoolValue && CheckCommandAccess(client, "sleuth_admin", ADMFLAG_BAN, false))
{
return;
}

if (FindStringInArray(g_hAllowedArray, steamid) == -1)
if(FindStringInArray(g_hAllowedArray, steamid) == -1)
{
decl String:IP[32], String:Prefix[64];
new String:IP[32], String:Prefix[64];
GetClientIP(client, IP, sizeof(IP));

g_cVar_sbprefix.GetString(Prefix, sizeof(Prefix));

decl String:query[1024];

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);
new String:query[1024];

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

new Handle:datapack = CreateDataPack();

WritePackCell(datapack, GetClientUserId(client));
WritePackString(datapack, steamid);
WritePackString(datapack, IP);
Expand All @@ -173,12 +173,12 @@ public SQL_CheckHim(Handle:owner, Handle:hndl, const String:error[], any:datapac
new client;
decl String:steamid[32], String:IP[32];

if (datapack != INVALID_HANDLE)
if(datapack != INVALID_HANDLE)
{
client = GetClientOfUserId(ReadPackCell(datapack));
ReadPackString(datapack, steamid, sizeof(steamid));
ReadPackString(datapack, IP, sizeof(IP));
CloseHandle(datapack);
CloseHandle(datapack);
}

if (hndl == INVALID_HANDLE)
Expand All @@ -190,14 +190,14 @@ public SQL_CheckHim(Handle:owner, Handle:hndl, const String:error[], any:datapac
{
new TotalBans = SQL_GetRowCount(hndl);

if (TotalBans > g_cVar_bansAllowed.IntValue)
if(TotalBans > g_cVar_bansAllowed.IntValue)
{
switch (g_cVar_actions.IntValue)
{
case LENGTH_ORIGINAL:
{
new length = SQL_FetchInt(hndl, 6);
new time = length * 60;
new time = length*60;

BanPlayer(client, time);
}
Expand All @@ -209,14 +209,14 @@ public SQL_CheckHim(Handle:owner, Handle:hndl, const String:error[], any:datapac
case LENGTH_DOUBLE:
{
new length = SQL_FetchInt(hndl, 6);
new time = length / 60 * 2;
new time = length/60*2;

BanPlayer(client, time);
}
case LENGTH_NOTIFY:
{
/* Notify Admins when a client with an ip on the bans list connects */
PrintToAdmins("[SourceSleuth] %t", "sourcesleuth_admintext", client, steamid, IP);
PrintToAdmins("[SourceSleuth] %t", "sourcesleuth_admintext",client, steamid, IP);
}
}
}
Expand All @@ -232,9 +232,9 @@ stock BanPlayer(client, time)

PrintToAdmins(const String:format[], any:...)
{
decl String:g_Buffer[256];
new String:g_Buffer[256];

for (new i = 1; i <= MaxClients; i++)
for (new i=1;i<=MaxClients;i++)
{
if (CheckCommandAccess(i, "sm_sourcesleuth_printtoadmins", ADMFLAG_BAN) && IsClientInGame(i))
{
Expand All @@ -248,25 +248,17 @@ PrintToAdmins(const String:format[], any:...)
public LoadWhiteList()
{
decl String:path[PLATFORM_MAX_PATH], String:line[256];

BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "configs/sourcesleuth_whitelist.cfg");

new Handle:fileHandle = OpenFile(path, "r");

if (fileHandle != INVALID_HANDLE)
{
while (!IsEndOfFile(fileHandle) && ReadFileLine(fileHandle, line, sizeof(line)))
{
ReplaceString(line, sizeof(line), "\n", "", false);

PushArrayString(g_hAllowedArray, line);
}

CloseHandle(fileHandle);
}
else

while(!IsEndOfFile(fileHandle) && ReadFileLine(fileHandle, line, sizeof(line)))
{
LogError("[SM] Warning File: \"configs/sourcesleuth_whitelist.cfg\" missing or inaccessible.");
LogError("[SM] Continuing without loading ip address whitelists.");
ReplaceString(line, sizeof(line), "\n", "", false);

PushArrayString(g_hAllowedArray, line);
}

CloseHandle(fileHandle);
}
18 changes: 9 additions & 9 deletions game_upload/addons/sourcemod/scripting/include/sourcebans.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// *************************************************************************
// This file is part of SourceBans++.
//
// Copyright (C) 2014-2016 Sarabveer Singh <me@sarabveer.me>
// Copyright (C) 2014-2015 Sarabveer Singh <sarabveer@sarabveer.me>
//
// SourceBans++ is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand All @@ -25,19 +25,19 @@
// *************************************************************************

#if defined _sourcebans_included
#endinput
#endinput
#endif
#define _sourcebans_included

public SharedPlugin:__pl_sourcebans =
{
name = "SourceBans",
file = "sourcebans.smx",
#if defined REQUIRE_PLUGIN
required = 1
#else
required = 0
#endif
name = "SourceBans",
file = "sourcebans.smx",
#if defined REQUIRE_PLUGIN
required = 1
#else
required = 0
#endif
};

#if !defined REQUIRE_PLUGIN
Expand Down
26 changes: 13 additions & 13 deletions game_upload/addons/sourcemod/scripting/include/sourcecomms.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// *************************************************************************
// This file is part of SourceBans++.
//
// Copyright (C) 2014-2016 Sarabveer Singh <me@sarabveer.me>
// Copyright (C) 2014-2015 Sarabveer Singh <sarabveer@sarabveer.me>
//
// SourceBans++ is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand All @@ -25,16 +25,16 @@
// *************************************************************************

#if defined _sourcecomms_included
#endinput
#endinput
#endif
#define _sourcecomms_included

/* Punishments types */
enum bType {
bNot = 0, // Player chat or voice is not blocked
bSess, // ... blocked for player session (until reconnect)
bTime, // ... blocked for some time
bPerm // ... permanently blocked
enum bType{
bNot = 0, // Player chat or voice is not blocked
bSess, // ... blocked for player session (until reconnect)
bTime, // ... blocked for some time
bPerm // ... permanently blocked
}

/**
Expand Down Expand Up @@ -82,14 +82,14 @@ native bType:SourceComms_GetClientMuteType(client);
*/
native bType:SourceComms_GetClientGagType(client);

public SharedPlugin:__pl_sourcecomms =
public SharedPlugin:__pl_sourcecomms =
{
name = "sourcecomms",
file = "sourcecomms.smx",
name = "sourcecomms",
file = "sourcecomms.smx",
#if defined REQUIRE_PLUGIN
required = 1
required = 1
#else
required = 0
required = 0
#endif
};

Expand All @@ -99,5 +99,5 @@ public __pl_sourcecomms_SetNTVOptional()
MarkNativeAsOptional("SourceComms_SetClientGag");
MarkNativeAsOptional("SourceComms_GetClientMuteType");
MarkNativeAsOptional("SourceComms_GetClientGagType");

}
18 changes: 9 additions & 9 deletions game_upload/addons/sourcemod/scripting/sb_admcfg.sp
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@

public Plugin:myinfo =
{
name = "SourceBans++: Admin Config Loader",
author = "AlliedModders LLC, Sarabveer(VEER™)",
description = "Reads admin files",
version = "1.5.4.2",
name = "SourceBans: Admin Config Loader",
author = "AlliedModders LLC, Sarabveer(VEER™)",
description = "Reads admin files",
version = "(SB++) 1.5.4.3",
url = "https://github.com/Sarabveer/SourceBans-Fork"
};

/** Various parsing globals */
new bool:g_LoggedFileName = false; /* Whether or not the file name has been logged */
new g_ErrorCount = 0; /* Current error count */
new g_IgnoreLevel = 0; /* Nested ignored section count, so users can screw up files safely */
new g_CurrentLine = 0; /* Current line we're on */
new String:g_Filename[PLATFORM_MAX_PATH]; /* Used for error messages */
new bool:g_LoggedFileName = false; /* Whether or not the file name has been logged */
new g_ErrorCount = 0; /* Current error count */
new g_IgnoreLevel = 0; /* Nested ignored section count, so users can screw up files safely */
new g_CurrentLine = 0; /* Current line we're on */
new String:g_Filename[PLATFORM_MAX_PATH]; /* Used for error messages */

#include "sb_admcfg/sb_admin_groups.sp"
#include "sb_admcfg/sb_admin_users.sp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// *************************************************************************
// This file is part of SourceBans++.
//
// Copyright (C) 2014-2016 Sarabveer Singh <me@sarabveer.me>
// Copyright (C) 2014-2015 Sarabveer Singh <sarabveer@sarabveer.me>
//
// SourceBans++ is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -74,10 +74,10 @@ public SMCResult ReadGroups_NewSection(SMCParser smc, const char[] name, bool op
}

public SMCResult ReadGroups_KeyValue(SMCParser smc,
const char[] key,
const char[] value,
bool key_quotes,
bool value_quotes)
const char[] key,
const char[] value,
bool key_quotes,
bool value_quotes)
{
if (g_CurGrp == INVALID_GROUP_ID || g_IgnoreLevel)
{
Expand All @@ -93,7 +93,7 @@ public SMCResult ReadGroups_KeyValue(SMCParser smc,
if (StrEqual(key, "flags", false))
{
new len = strlen(value);
for (new i = 0; i < len; i++)
for (new i=0; i<len; i++)
{
if (!FindFlagByChar(value[i], flag))
{
Expand All @@ -120,7 +120,7 @@ public SMCResult ReadGroups_KeyValue(SMCParser smc,
}
}
} else if (g_GroupPass == GROUP_PASS_SECOND
&& g_GroupState == GROUP_STATE_INGROUP) {
&& g_GroupState == GROUP_STATE_INGROUP) {
/* Check for immunity again, core should handle double inserts */
if (StrEqual(key, "immunity", false))
{
Expand Down Expand Up @@ -206,7 +206,7 @@ static InternalReadGroups(const String:path[], pass)
g_CurGrp = INVALID_GROUP_ID;
g_GroupPass = pass;
g_NeedReparse = false;

SMCError err = g_hGroupParser.ParseFile(path);
if (err != SMCError_Okay)
{
Expand Down
Loading

0 comments on commit f9f19c1

Please sign in to comment.