Fixed amb1454 - Nextmap broken on mods that use the scores usermsg differently to CS:S
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402185
This commit is contained in:
parent
73a20de2ff
commit
d9357d5224
@ -18,14 +18,14 @@ OBJECTS = AdminCache.cpp CDataPack.cpp ConCmdManager.cpp ConVarManager.cpp CoreC
|
||||
sm_autonatives.cpp sm_memtable.cpp sm_srvcmds.cpp sm_stringutil.cpp sm_trie.cpp \
|
||||
sourcemm_api.cpp sourcemod.cpp MenuStyle_Base.cpp MenuStyle_Valve.cpp MenuManager.cpp \
|
||||
MenuStyle_Radio.cpp ChatTriggers.cpp ADTFactory.cpp MenuVoting.cpp sm_crc32.cpp \
|
||||
frame_hooks.cpp concmd_cleaner.cpp Profiler.cpp PhraseCollection.cpp
|
||||
frame_hooks.cpp concmd_cleaner.cpp Profiler.cpp PhraseCollection.cpp NextMap.cpp
|
||||
OBJECTS += smn_admin.cpp smn_bitbuffer.cpp smn_console.cpp smn_core.cpp \
|
||||
smn_datapacks.cpp smn_entities.cpp smn_events.cpp smn_fakenatives.cpp \
|
||||
smn_filesystem.cpp smn_float.cpp smn_functions.cpp smn_gameconfigs.cpp smn_halflife.cpp \
|
||||
smn_handles.cpp smn_keyvalues.cpp smn_banning.cpp smn_maplists.cpp \
|
||||
smn_lang.cpp smn_player.cpp smn_string.cpp smn_sorting.cpp smn_textparse.cpp smn_timers.cpp \
|
||||
smn_usermsgs.cpp smn_menus.cpp smn_database.cpp smn_vector.cpp smn_adt_array.cpp \
|
||||
smn_adt_trie.cpp smn_hudtext.cpp smn_adt_stack.cpp
|
||||
smn_adt_trie.cpp smn_hudtext.cpp smn_adt_stack.cpp smn_nextmap.cpp
|
||||
OBJECTS += systems/ExtensionSys.cpp systems/ForwardSys.cpp systems/HandleSys.cpp \
|
||||
systems/LibrarySys.cpp systems/PluginInfoDatabase.cpp systems/PluginSys.cpp \
|
||||
systems/ShareSys.cpp vm/sp_vm_basecontext.cpp vm/sp_vm_engine.cpp \
|
||||
|
90
core/NextMap.cpp
Normal file
90
core/NextMap.cpp
Normal file
@ -0,0 +1,90 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "NextMap.h"
|
||||
#include "Logger.h"
|
||||
#include "sourcemm_api.h"
|
||||
#include "sm_stringutil.h"
|
||||
|
||||
NextMapManager g_NextMap;
|
||||
|
||||
SH_DECL_HOOK2_void(IVEngineServer, ChangeLevel, SH_NOATTRIB, 0, const char *, const char *);
|
||||
|
||||
ConVar sm_nextmap("sm_nextmap", "", FCVAR_NOTIFY);
|
||||
|
||||
void NextMapManager::OnSourceModAllInitialized_Post()
|
||||
{
|
||||
#if defined ORANGEBOX_BUILD
|
||||
SH_ADD_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
|
||||
#else
|
||||
SH_ADD_HOOK_MEMFUNC(IVEngineServer, ChangeLevel, engine, this, &NextMapManager::HookChangeLevel, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void NextMapManager::OnSourceModShutdown()
|
||||
{
|
||||
#if defined ORANGEBOX_BUILD
|
||||
SH_REMOVE_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
|
||||
#else
|
||||
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, ChangeLevel, engine, this, &NextMapManager::HookChangeLevel, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *NextMapManager::GetNextMap()
|
||||
{
|
||||
return sm_nextmap.GetString();
|
||||
}
|
||||
|
||||
bool NextMapManager::SetNextMap(const char *map)
|
||||
{
|
||||
if (!engine->IsMapValid(map))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
sm_nextmap.SetValue(map);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void NextMapManager::HookChangeLevel(const char *map, const char *unknown)
|
||||
{
|
||||
const char *newmap = sm_nextmap.GetString();
|
||||
|
||||
if (newmap[0] == 0 || !engine->IsMapValid(newmap))
|
||||
{
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
g_Logger.LogMessage("[SM] Changed map to \"%s\"", newmap);
|
||||
|
||||
RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::ChangeLevel, (newmap, unknown));
|
||||
}
|
52
core/NextMap.h
Normal file
52
core/NextMap.h
Normal file
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_SOURCEMOD_NEXTMAP_H_
|
||||
#define _INCLUDE_SOURCEMOD_NEXTMAP_H_
|
||||
|
||||
#include "sm_globals.h"
|
||||
#include "eiface.h"
|
||||
|
||||
class NextMapManager : public SMGlobalClass
|
||||
{
|
||||
public:
|
||||
void OnSourceModAllInitialized_Post();
|
||||
void OnSourceModShutdown();
|
||||
|
||||
const char *GetNextMap();
|
||||
bool SetNextMap(const char *map);
|
||||
|
||||
void HookChangeLevel(const char *map, const char *unknown);
|
||||
};
|
||||
|
||||
extern NextMapManager g_NextMap;
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_NEXTMAP_H_
|
@ -901,6 +901,10 @@
|
||||
RelativePath="..\MenuVoting.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\NextMap.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PhraseCollection.cpp"
|
||||
>
|
||||
@ -1067,6 +1071,10 @@
|
||||
RelativePath="..\MenuVoting.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\NextMap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\PhraseCollection.h"
|
||||
>
|
||||
@ -1634,6 +1642,10 @@
|
||||
RelativePath="..\smn_menus.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_nextmap.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_player.cpp"
|
||||
>
|
||||
|
41
core/msvc9/sourcemod_mm.sln
Normal file
41
core/msvc9/sourcemod_mm.sln
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual C++ Express 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sourcemod_mm", "sourcemod_mm.vcproj", "{E39527CD-7CAB-4420-97CC-DA1B93B260BC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
CrazyDebug - Episode 1|Win32 = CrazyDebug - Episode 1|Win32
|
||||
CrazyDebug - Old Metamod|Win32 = CrazyDebug - Old Metamod|Win32
|
||||
CrazyDebug - Orange Box|Win32 = CrazyDebug - Orange Box|Win32
|
||||
Debug - Episode 1|Win32 = Debug - Episode 1|Win32
|
||||
Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32
|
||||
Debug - Orange Box|Win32 = Debug - Orange Box|Win32
|
||||
Release - Episode 1|Win32 = Release - Episode 1|Win32
|
||||
Release - Old Metamod|Win32 = Release - Old Metamod|Win32
|
||||
Release - Orange Box|Win32 = Release - Orange Box|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.ActiveCfg = CrazyDebug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.Build.0 = CrazyDebug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.ActiveCfg = CrazyDebug - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.Build.0 = CrazyDebug - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box|Win32.ActiveCfg = CrazyDebug - Orange Box|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box|Win32.Build.0 = CrazyDebug - Orange Box|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.ActiveCfg = Debug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.Build.0 = Debug - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Old Metamod|Win32.ActiveCfg = Debug - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Old Metamod|Win32.Build.0 = Debug - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box|Win32.ActiveCfg = Debug - Orange Box|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box|Win32.Build.0 = Debug - Orange Box|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.ActiveCfg = Release - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.Build.0 = Release - Episode 1|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Old Metamod|Win32.ActiveCfg = Release - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Old Metamod|Win32.Build.0 = Release - Old Metamod|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box|Win32.ActiveCfg = Release - Orange Box|Win32
|
||||
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box|Win32.Build.0 = Release - Orange Box|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
1723
core/msvc9/sourcemod_mm.vcproj
Normal file
1723
core/msvc9/sourcemod_mm.vcproj
Normal file
File diff suppressed because it is too large
Load Diff
63
core/smn_nextmap.cpp
Normal file
63
core/smn_nextmap.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include "sm_globals.h"
|
||||
#include "NextMap.h"
|
||||
|
||||
static cell_t sm_GetNextMap(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
const char *map = g_NextMap.GetNextMap();
|
||||
|
||||
if (map[0] == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
pCtx->StringToLocal(params[1], params[2], map);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t sm_SetNextMap(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
char *map;
|
||||
pCtx->LocalToString(params[1], &map);
|
||||
|
||||
return g_NextMap.SetNextMap(map);
|
||||
}
|
||||
|
||||
|
||||
REGISTER_NATIVES(nextmapnatives)
|
||||
{
|
||||
{"GetNextMap", sm_GetNextMap},
|
||||
{"SetNextMap", sm_SetNextMap},
|
||||
{NULL, NULL},
|
||||
};
|
54
plugins/include/nextmap.inc
Normal file
54
plugins/include/nextmap.inc
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This file is part of the SourceMod/SourcePawn SDK.
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <http://www.sourcemod.net/license.php>.
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#if defined _nextmap_included_
|
||||
#endinput
|
||||
#endif
|
||||
#define _nextmap_included_
|
||||
|
||||
/**
|
||||
* Sets SourceMod's internal nextmap.
|
||||
* Equivalent to changing sm_nextmap but with an added validity check.
|
||||
*
|
||||
* @param map Next map to set.
|
||||
* @return True if the nextmap was set, false if map was invalid.
|
||||
*/
|
||||
native bool:SetNextMap(const String:map[]);
|
||||
|
||||
/**
|
||||
* Returns SourceMod's internal nextmap.
|
||||
*
|
||||
* @param map Buffer to store the nextmap name.
|
||||
* @param maxlen Maximum length of the map buffer.
|
||||
* @return True if a Map was found and copied, false if no nextmap is set (map will be unchanged).
|
||||
*/
|
||||
native bool:GetNextMap(String:map[], maxlen);
|
@ -72,6 +72,7 @@ struct Plugin
|
||||
#include <adt>
|
||||
#include <banning>
|
||||
#include <commandfilters>
|
||||
#include <nextmap>
|
||||
|
||||
/**
|
||||
* Declare this as a struct in your plugin to expose its information.
|
||||
|
@ -34,6 +34,8 @@
|
||||
#pragma semicolon 1
|
||||
|
||||
#include <sourcemod>
|
||||
#include "include/nextmap.inc"
|
||||
|
||||
|
||||
public Plugin:myinfo =
|
||||
{
|
||||
@ -44,12 +46,7 @@ public Plugin:myinfo =
|
||||
url = "http://www.sourcemod.net/"
|
||||
};
|
||||
|
||||
new bool:g_IntermissionCalled;
|
||||
new UserMsg:g_VGUIMenu;
|
||||
|
||||
new Handle:g_Cvar_Chattime;
|
||||
new Handle:g_Cvar_Nextmap;
|
||||
|
||||
new g_MapPos = -1;
|
||||
new Handle:g_MapList = INVALID_HANDLE;
|
||||
new g_MapListSerial = -1;
|
||||
@ -59,19 +56,7 @@ public OnPluginStart()
|
||||
LoadTranslations("common.phrases");
|
||||
LoadTranslations("nextmap.phrases");
|
||||
|
||||
g_VGUIMenu = GetUserMessageId("VGUIMenu");
|
||||
if (g_VGUIMenu == INVALID_MESSAGE_ID)
|
||||
{
|
||||
LogError("FATAL: Cannot find VGUIMenu user message id. Nextmap not loaded.");
|
||||
SetFailState("VGUIMenu Not Found");
|
||||
}
|
||||
|
||||
g_MapList = CreateArray(32);
|
||||
|
||||
HookUserMessage(g_VGUIMenu, UserMsg_VGUIMenu);
|
||||
|
||||
g_Cvar_Nextmap = CreateConVar("sm_nextmap", "", "Sets the Next Map", FCVAR_NOTIFY);
|
||||
g_Cvar_Chattime = FindConVar("mp_chattime");
|
||||
|
||||
RegConsoleCmd("say", Command_Say);
|
||||
RegConsoleCmd("say_team", Command_Say);
|
||||
@ -87,13 +72,13 @@ public OnPluginStart()
|
||||
// Set to the current map so OnMapStart() will know what to do
|
||||
decl String:currentMap[64];
|
||||
GetCurrentMap(currentMap, 64);
|
||||
SetConVarString(g_Cvar_Nextmap, currentMap);
|
||||
SetNextMap(currentMap);
|
||||
}
|
||||
|
||||
public OnConfigsExecuted()
|
||||
{
|
||||
decl String:lastMap[64], String:currentMap[64];
|
||||
GetConVarString(g_Cvar_Nextmap, lastMap, 64);
|
||||
GetNextMap(lastMap, sizeof(lastMap));
|
||||
GetCurrentMap(currentMap, 64);
|
||||
|
||||
// Why am I doing this? If we switched to a new map, but it wasn't what we expected (Due to sm_map, sm_votemap, or
|
||||
@ -104,11 +89,6 @@ public OnConfigsExecuted()
|
||||
FindAndSetNextMap();
|
||||
}
|
||||
}
|
||||
|
||||
public OnMapEnd()
|
||||
{
|
||||
g_IntermissionCalled = false;
|
||||
}
|
||||
|
||||
public Action:Command_Say(client, args)
|
||||
{
|
||||
@ -131,7 +111,7 @@ public Action:Command_Say(client, args)
|
||||
if (strcmp(message, "nextmap", false) == 0)
|
||||
{
|
||||
decl String:map[32];
|
||||
GetConVarString(g_Cvar_Nextmap, map, sizeof(map));
|
||||
GetNextMap(map, sizeof(map));
|
||||
|
||||
PrintToChat(client, "%t", "Next Map", map);
|
||||
}
|
||||
@ -156,10 +136,10 @@ public Action:Command_SetNextmap(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
ShowActivity(client, "%t", "Cvar changed", "sm_nextmap", map);
|
||||
LogMessage("\"%L\" changed sm_nextmap to \"%s\"", client, map);
|
||||
ShowActivity(client, "%t", "Changed Next Map", map);
|
||||
LogMessage("\"%L\" changed nextmap to \"%s\"", client, map);
|
||||
|
||||
SetConVarString(g_Cvar_Nextmap, map);
|
||||
SetNextMap(map);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
@ -179,76 +159,17 @@ public Action:Command_List(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:UserMsg_VGUIMenu(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init)
|
||||
{
|
||||
if (g_IntermissionCalled)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
decl String:type[15];
|
||||
|
||||
/* If we don't get a valid string, bail out. */
|
||||
if (BfReadString(bf, type, sizeof(type)) < 0)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
if (BfReadByte(bf) == 1 && BfReadByte(bf) == 0 && (strcmp(type, "scores", false) == 0))
|
||||
{
|
||||
g_IntermissionCalled = true;
|
||||
|
||||
decl String:map[32];
|
||||
new Float:fChatTime = GetConVarFloat(g_Cvar_Chattime);
|
||||
|
||||
GetConVarString(g_Cvar_Nextmap, map, sizeof(map));
|
||||
|
||||
if (!IsMapValid(map))
|
||||
{
|
||||
if (g_MapPos == -1)
|
||||
{
|
||||
FindAndSetNextMap();
|
||||
}
|
||||
GetArrayString(g_MapList, g_MapPos, map, sizeof(map));
|
||||
}
|
||||
|
||||
if (fChatTime < 2.0)
|
||||
SetConVarFloat(g_Cvar_Chattime, 2.0);
|
||||
|
||||
new Handle:dp;
|
||||
CreateDataTimer(fChatTime - 1.0, Timer_ChangeMap, dp);
|
||||
WritePackString(dp, map);
|
||||
}
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Command_Nextmap(args)
|
||||
{
|
||||
decl String:map[64];
|
||||
|
||||
GetConVarString(g_Cvar_Nextmap, map, sizeof(map));
|
||||
GetNextMap(map, sizeof(map));
|
||||
|
||||
ReplyToCommand(0, "%t", "Next Map", map);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action:Timer_ChangeMap(Handle:timer, Handle:dp)
|
||||
{
|
||||
new String:map[32];
|
||||
|
||||
ResetPack(dp);
|
||||
ReadPackString(dp, map, sizeof(map));
|
||||
|
||||
InsertServerCommand("changelevel \"%s\"", map);
|
||||
ServerExecute();
|
||||
|
||||
LogMessage("Nextmap changed map to \"%s\"", map);
|
||||
|
||||
return Plugin_Stop;
|
||||
}
|
||||
|
||||
FindAndSetNextMap()
|
||||
{
|
||||
if (ReadMapList(g_MapList,
|
||||
@ -291,5 +212,5 @@ FindAndSetNextMap()
|
||||
g_MapPos = 0;
|
||||
|
||||
GetArrayString(g_MapList, g_MapPos, mapName, sizeof(mapName));
|
||||
SetConVarString(g_Cvar_Nextmap, mapName);
|
||||
SetNextMap(mapName);
|
||||
}
|
||||
|
@ -2,7 +2,12 @@
|
||||
{
|
||||
"Next Map"
|
||||
{
|
||||
#format "{1:s}"
|
||||
"#format" "{1:s}"
|
||||
"en" "Next Map: {1}"
|
||||
}
|
||||
"Changed Next Map"
|
||||
{
|
||||
"#format" "{1:s}"
|
||||
"en" "Changed nextmap to \"{1}\"."
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user