/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Map Management Plugin
* Provides all map related functionality, including map changing, map voting,
* and nextmap.
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program 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
* this program. If not, see .
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or .
*
* Version: $Id$
*/
#pragma semicolon 1
#include
#undef REQUIRE_PLUGIN
#include
public Plugin:myinfo =
{
name = "Map Manager",
author = "AlliedModders LLC",
description = "Map Management",
version = SOURCEMOD_VERSION,
url = "http://www.sourcemod.net/"
};
#include "mapmanager/globals.sp"
#include "mapmanager/commands.sp"
#include "mapmanager/events.sp"
#include "mapmanager/functions.sp"
#include "mapmanager/functions_menu.sp"
#include "mapmanager/menus.sp"
#include "mapmanager/timers.sp"
#include "mapmanager/votes.sp"
public OnPluginStart()
{
LoadTranslations("mapmanager.phrases");
// Prepare nextmap functionality.
g_VGUIMenu = GetUserMessageId("VGUIMenu");
if (g_VGUIMenu == INVALID_MESSAGE_ID)
{
LogError("FATAL: Cannot find VGUIMenu user message id. MapManager crippled.");
g_NextMapEnabled = false;
}
HookUserMessage(g_VGUIMenu, UserMsg_VGUIMenu);
// Create all of the arrays, sized for a 64 character string.
new arraySize = ByteCountToCells(64);
g_MapCycle = CreateArray(arraySize);
g_MapList = CreateArray(arraySize);
g_MapHistory = CreateArray(arraySize);
g_NextVoteMaps = CreateArray(arraySize);
g_SelectedMaps = CreateArray(arraySize);
g_NominatedMaps = CreateArray(arraySize);
g_TeamScores = CreateArray(2);
// Hook say
RegConsoleCmd("say", Command_Say);
RegConsoleCmd("say_team", Command_Say);
// Register all commands.
RegAdminCmd("sm_map", Command_Map, ADMFLAG_CHANGEMAP, "sm_map