dvander@1423: /**
dvander@1423: * vim: set ts=4 :
dvander@1423: * =============================================================================
dvander@1423: * SourceMod Basic Commands Plugin
dvander@1423: * Implements basic admin commands.
dvander@1423: *
ds@1947: * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
dvander@1423: * =============================================================================
dvander@1423: *
dvander@1423: * This program is free software; you can redistribute it and/or modify it under
dvander@1423: * the terms of the GNU General Public License, version 3.0, as published by the
dvander@1423: * Free Software Foundation.
dvander@1423: *
dvander@1423: * This program is distributed in the hope that it will be useful, but WITHOUT
dvander@1423: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
dvander@1423: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
dvander@1423: * details.
dvander@1423: *
dvander@1423: * You should have received a copy of the GNU General Public License along with
dvander@1423: * this program. If not, see .
dvander@1423: *
dvander@1423: * As a special exception, AlliedModders LLC gives you permission to link the
dvander@1423: * code of this program (as well as its derivative works) to "Half-Life 2," the
dvander@1423: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
dvander@1423: * by the Valve Corporation. You must obey the GNU General Public License in
dvander@1423: * all respects for all other code used. Additionally, AlliedModders LLC grants
dvander@1423: * this exception to all derivative works. AlliedModders LLC defines further
dvander@1423: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
dvander@1423: * or .
dvander@1423: *
dvander@1423: * Version: $Id$
dvander@1423: */
dvander@1423:
dvander@1423: #pragma semicolon 1
dvander@1423:
dvander@1423: #include
pred@1536: #undef REQUIRE_PLUGIN
pred@1536: #include
dvander@1423:
dvander@1423: public Plugin:myinfo =
dvander@1423: {
dvander@1423: name = "Basic Ban Commands",
dvander@1423: author = "AlliedModders LLC",
dvander@1423: description = "Basic Banning Commands",
dvander@1423: version = SOURCEMOD_VERSION,
dvander@1423: url = "http://www.sourcemod.net/"
dvander@1423: };
dvander@1423:
pred@1536: new Handle:hTopMenu = INVALID_HANDLE;
pred@1536:
pred@1536: new g_BanTarget[MAXPLAYERS+1];
pred@2221: new g_BanTargetUserId[MAXPLAYERS+1];
pred@1536: new g_BanTime[MAXPLAYERS+1];
pred@1536:
CPUCalc@4089: new g_IsWaitingForChatReason[MAXPLAYERS+1];
CPUCalc@4089: new Handle:g_hKvBanReasons;
CPUCalc@4089: new String:g_BanReasonsPath[PLATFORM_MAX_PATH];
CPUCalc@4089:
pred@1536: #include "basebans/ban.sp"
pred@1536:
CPUCalc@4089: public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
CPUCalc@4089: {
CPUCalc@4089: BuildPath(Path_SM, g_BanReasonsPath, sizeof(g_BanReasonsPath), "configs/banreasons.txt");
CPUCalc@4089: if(LoadBanReasons())
CPUCalc@4089: {
CPUCalc@4089: return APLRes_Success;
CPUCalc@4089: }
CPUCalc@4089: else
CPUCalc@4089: {
CPUCalc@4089: Format(error, err_max, "Couldn't load file %s: See log for details.", g_BanReasonsPath);
CPUCalc@4089: return APLRes_Failure;
CPUCalc@4089: }
CPUCalc@4089: }
CPUCalc@4089:
dvander@1423: public OnPluginStart()
dvander@1423: {
dvander@1423: LoadTranslations("common.phrases");
dvander@1625: LoadTranslations("basebans.phrases");
CPUCalc@4089: LoadTranslations("core.phrases");
dvander@1423:
dvander@1423: RegAdminCmd("sm_ban", Command_Ban, ADMFLAG_BAN, "sm_ban <#userid|name> [reason]");
skamonkey@2932: RegAdminCmd("sm_unban", Command_Unban, ADMFLAG_UNBAN, "sm_unban ");
dvander@1423: RegAdminCmd("sm_addban", Command_AddBan, ADMFLAG_RCON, "sm_addban