// ************************************************************************* // This file is part of SourceBans++. // // Copyright (C) 2014-2019 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 #pragma newdecls required #define SB_VERSION "1.7.0" #if defined _updater_included #define UPDATE_URL "https://sbpp.github.io/updater/updatefile.txt" #endif //GLOBAL DEFINES #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 */ SMCParser ConfigParser; Handle g_hFwd_OnBanAdded , g_hFwd_OnReportAdded , PlayerRecheck[MAXPLAYERS + 1] = { INVALID_HANDLE, ... }; /* Timer handle */ DataPack PlayerDataPack[MAXPLAYERS + 1] = { null, ... }; TopMenu hTopMenu = null; Menu TimeMenuHandle , ReasonMenuHandle , HackingMenuHandle; public Plugin myinfo = { name = "SourceBans++: Main Plugin", author = "SourceBans Development Team, SourceBans++ Dev Team", description = "Advanced ban management for the Source engine", version = SB_VERSION, url = "https://sbpp.github.io" }; public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) { 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; return APLRes_Success; } public void OnPluginStart() { LoadTranslations("common.phrases"); LoadTranslations("plugin.basecommands"); LoadTranslations("sbpp_main.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); 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