/** * sourcebans.sp * * This file contains all Source Server Plugin Functions * @author SourceBans Development Team * @version 0.0.0.$Rev: 108 $ * @copyright InterWave Studios (www.interwavestudios.com) * @package SourceBans * @link http://www.sourcebans.net */ #pragma semicolon 1 #include #include #undef REQUIRE_PLUGIN #include #include "dbi.inc" #define SB_VERSION "1.4.8" //GLOBAL DEFINES #define YELLOW 0x01 #define NAMECOLOR 0x02 #define TEAMCOLOR 0x03 #define GREEN 0x04 #define DISABLE_ADDBAN 1 #define DISABLE_UNBAN 2 //#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:BLANK[] = ""; 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[26]; /* Admin KeyValues */ new String:groupsLoc[128]; new String:adminsLoc[128]; /* Cvar handle*/ new Handle:CvarHostIp; new Handle:CvarPort; /* Database handle */ new Handle:Database; 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 MaxSlots; 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", description = "Advanced ban management for the Source engine", version = SB_VERSION, url = "http://www.sourcebans.net" }; #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_PLUGIN|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]"); RegAdminCmd("sm_banip", CommandBanIp, ADMFLAG_BAN, "sm_banip