// ************************************************************************* // This file is part of SourceBans++. // // Copyright (C) 2014-2016 SourceBans++ Dev Team // // SourceBans++ is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, per version 3 of the License. // // SourceBans++ is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with SourceBans++. If not, see . // // This file is based off work(s) covered by the following copyright(s): // // SourceBans 1.4.11 // Copyright (C) 2007-2015 SourceBans Team - Part of GameConnect // Licensed under GNU GPL version 3, or later. // Page: - // // ************************************************************************* #pragma semicolon 1 #include #include #undef REQUIRE_PLUGIN #include #tryinclude #define SB_VERSION "1.6.4" #define SBR_VERSION "1.6.4" #if defined _updater_included #define UPDATE_URL "https://sbpp.github.io/updater/updatefile.txt" #endif //GLOBAL DEFINES #define YELLOW 0x01 #define NAMECOLOR 0x02 #define TEAMCOLOR 0x03 #define GREEN 0x04 #define DISABLE_ADDBAN 1 #define DISABLE_UNBAN 2 #define FLAG_LETTERS_SIZE 26 //#define DEBUG enum State/* ConfigState */ { ConfigStateNone = 0, ConfigStateConfig, ConfigStateReasons, ConfigStateHacking, ConfigStateTime } State ConfigState; #define Prefix "[SourceBans++] " /* Admin Stuff*/ AdminCachePart loadPart; AdminFlag g_FlagLetters[FLAG_LETTERS_SIZE]; /* Cvar handle*/ ConVar CvarHostIp , CvarPort; /* Database handle */ Database DB; Database SQLiteDB; char ServerIp[24] , ServerPort[7] , DatabasePrefix[10] = "sb" , WebsiteAddress[128] , groupsLoc[128] /* Admin KeyValues */ , adminsLoc[128] , overridesLoc[128] , logFile[256]; /* Log Stuff */ float RetryTime = 15.0; bool loadAdmins /* Admin Stuff*/ , loadGroups , loadOverrides , LateLoaded , AutoAdd , g_bConnecting = false , requireSiteLogin = false /* Require a lastvisited from SB site */ , backupConfig = true , enableAdmins = true , PlayerStatus[MAXPLAYERS + 1]; /* Player ban check status */ int g_BanTarget[MAXPLAYERS + 1] = { -1, ... } , g_BanTime[MAXPLAYERS + 1] = { -1, ... } , curLoading , serverID = -1 , ProcessQueueTime = 5 , g_ownReasons[MAXPLAYERS + 1] = { false, ... } /* Own Chat Reason */ , CommandDisable; /* Disable of addban and unban */ Handle ConfigParser , hTopMenu = INVALID_HANDLE , TimeMenuHandle /* Menu file globals */ , ReasonMenuHandle , HackingMenuHandle , g_hFwd_OnBanAdded , g_hFwd_OnReportAdded , PlayerRecheck[MAXPLAYERS + 1] = { INVALID_HANDLE, ... } /* Datapack and Timer handles */ , PlayerDataPack[MAXPLAYERS + 1] = { INVALID_HANDLE, ... }; public Plugin myinfo = { name = "SourceBans++: Main Plugin", author = "SourceBans Development Team, SourceBans++ Dev Team", description = "Advanced ban management for the Source engine", version = SBR_VERSION, url = "https://sbpp.github.io" }; #if SOURCEMOD_V_MAJOR >= 1 && SOURCEMOD_V_MINOR >= 3 public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) #else public bool AskPluginLoad(Handle myself, bool late, char[] error, int err_max) #endif { RegPluginLibrary("sourcebans++"); CreateNative("SBBanPlayer", Native_SBBanPlayer); CreateNative("SBPP_BanPlayer", Native_SBBanPlayer); CreateNative("SBPP_ReportPlayer", Native_SBReportPlayer); g_hFwd_OnBanAdded = CreateGlobalForward("SBPP_OnBanPlayer", ET_Ignore, Param_Cell, Param_Cell, Param_Cell, Param_String); g_hFwd_OnReportAdded = CreateGlobalForward("SBPP_OnReportPlayer", ET_Ignore, Param_Cell, Param_Cell, Param_String); LateLoaded = late; #if SOURCEMOD_V_MAJOR >= 1 && SOURCEMOD_V_MINOR >= 3 return APLRes_Success; #else return true; #endif } public OnPluginStart() { LoadTranslations("common.phrases"); LoadTranslations("plugin.basecommands"); LoadTranslations("sourcebans.phrases"); LoadTranslations("basebans.phrases"); loadAdmins = loadGroups = loadOverrides = false; CvarHostIp = FindConVar("hostip"); CvarPort = FindConVar("hostport"); CreateConVar("sb_version", SB_VERSION, _, FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY); CreateConVar("sbr_version", SBR_VERSION, _, FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY); RegServerCmd("sm_rehash", sm_rehash, "Reload SQL admins"); RegAdminCmd("sm_ban", CommandBan, ADMFLAG_BAN, "sm_ban <#userid|name> [reason]", "sourcebans"); RegAdminCmd("sm_banip", CommandBanIp, ADMFLAG_BAN, "sm_banip