// ************************************************************************* // This file is part of SourceBans++. // // Copyright (C) 2014-2016 Sarabveer Singh // // 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 incorporates work 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.5.5F-dev" #define SBR_VERSION "1.5.5-dev" #if defined _updater_included #define UPDATE_URL "https://sarabveer.github.io/SourceBans-Fork/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 } new g_BanTarget[MAXPLAYERS + 1] = { -1, ... }; new g_BanTime[MAXPLAYERS + 1] = { -1, ... }; new State:ConfigState; new Handle:ConfigParser; new Handle:hTopMenu = INVALID_HANDLE; new const String:Prefix[] = "[SourceBans] "; new String:ServerIp[24]; new String:ServerPort[7]; new String:DatabasePrefix[10] = "sb"; new String:WebsiteAddress[128]; /* Admin Stuff*/ new AdminCachePart:loadPart; new bool:loadAdmins; new bool:loadGroups; new bool:loadOverrides; new curLoading = 0; new AdminFlag:g_FlagLetters[FLAG_LETTERS_SIZE]; /* Admin KeyValues */ new String:groupsLoc[128]; new String:adminsLoc[128]; new String:overridesLoc[128]; /* Cvar handle*/ new Handle:CvarHostIp; new Handle:CvarPort; /* Database handle */ new Handle:DB; new Handle:SQLiteDB; /* Menu file globals */ new Handle:ReasonMenuHandle; new Handle:HackingMenuHandle; /* Datapack and Timer handles */ new Handle:PlayerRecheck[MAXPLAYERS + 1] = { INVALID_HANDLE, ... }; new Handle:PlayerDataPack[MAXPLAYERS + 1] = { INVALID_HANDLE, ... }; /* Player ban check status */ new bool:PlayerStatus[MAXPLAYERS + 1]; /* Disable of addban and unban */ new CommandDisable; new bool:backupConfig = true; new bool:enableAdmins = true; /* Require a lastvisited from SB site */ new bool:requireSiteLogin = false; /* Log Stuff */ new String:logFile[256]; /* Own Chat Reason */ new g_ownReasons[MAXPLAYERS + 1] = { false, ... }; new Float:RetryTime = 15.0; new ProcessQueueTime = 5; new bool:LateLoaded; new bool:AutoAdd; new bool:g_bConnecting = false; new serverID = -1; public Plugin:myinfo = { name = "SourceBans++", author = "SourceBans Development Team, Sarabveer(VEERâ„¢)", description = "Advanced ban management for the Source engine", version = SBR_VERSION, url = "https://sarabveer.github.io/SourceBans-Fork/" }; #if SOURCEMOD_V_MAJOR >= 1 && SOURCEMOD_V_MINOR >= 3 public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) #else public bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max) #endif { RegPluginLibrary("sourcebans"); CreateNative("SBBanPlayer", Native_SBBanPlayer); 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