/**
* vim: set filetype=c :
*
* =============================================================================
* Dynamic Map Rotations
*
* Copyright 2008 Ryan Mannion. 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 as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 .
*/
#pragma semicolon 1
#include
#include
#define DMR_VERSION "0.7"
#define CVAR_CONFIG 0
#define CVAR_VERSION 1
#define CVAR_MAP_KEY 2
#define CVAR_CHAT_TIME 3
#define CVAR_FORCE_NEXTMAP 4
#define CVAR_NEXTMAP 5
#define CVAR_LOCK 6
#define CVAR_NUM_CVARS 7
#define MAX_CONDITIONS 8
#define MAX_KEY_LENGTH 32
#define MAX_VAL_LENGTH 32
new Handle:g_cvars[CVAR_NUM_CVARS];
new Handle:g_rotation = INVALID_HANDLE;
new UserMsg:g_VGUIMenu;
new bool:g_IntermissionCalled = false;
new bool:g_ForceNextMap = false;
new day_array[] = {'\0', 'm', 't', 'w', 'r', 'f', 's', 'u'};
new Handle:g_updateNextMapTimer = INVALID_HANDLE;
enum CompareTimeType {
NOW_LTE_TIME = 0,
NOW_GTE_TIME
};
enum CompareTimeResult {
NOW_LT_TIME = 0,
NOW_EQ_TIME,
NOW_GT_TIME
};
public Plugin:myinfo = {
name = "Dynamic Map Rotations",
author = "Ryan \"FLOOR_MASTER\" Mannion",
description = "Dynamically alters the map rotation based on server conditions.",
version = DMR_VERSION,
url = "http://www.2fort2furious.com"
};
public OnPluginStart() {
/* TODO Translations */
LoadTranslations("common.phrases");
if (FindPluginByFile("nextmap.smx") != INVALID_HANDLE) {
LogError("FATAL: This plugin replaces nextmap. You must remove nextmap.smx to load this plugin.");
SetFailState("This plugin replaces nextmap. You must remove nextmap.smx to load this plugin.");
}
g_VGUIMenu = GetUserMessageId("VGUIMenu");
if (g_VGUIMenu == INVALID_MESSAGE_ID) {
LogError("FATAL: Cannot find VGUIMenu user message id. Dynamic Map Rotations not loaded.");
SetFailState("VGUIMenu Not Found.");
}
HookUserMessage(g_VGUIMenu, UserMsg_VGUIMenu);
RegConsoleCmd("say", Command_Say);
RegConsoleCmd("say_team", Command_Say);
RegAdminCmd("sm_setnextmap", Command_SetNextmap, ADMFLAG_CHANGEMAP, "sm_setnextmap