Moved nextmap command into basetriggers.sp

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402417
This commit is contained in:
Matt Woodrow 2008-07-13 07:01:54 +00:00
parent 64b8049d70
commit 67e28d7475
4 changed files with 57 additions and 86 deletions

View File

@ -71,6 +71,7 @@ public OnPluginStart()
RegConsoleCmd("say_team", Command_Say); RegConsoleCmd("say_team", Command_Say);
RegConsoleCmd("timeleft", Command_Timeleft); RegConsoleCmd("timeleft", Command_Timeleft);
RegConsoleCmd("nextmap", Command_Nextmap);
HookConVarChange(g_Cvar_TimeleftInterval, ConVarChange_TimeleftInterval); HookConVarChange(g_Cvar_TimeleftInterval, ConVarChange_TimeleftInterval);
@ -115,6 +116,24 @@ public Action:Command_Timeleft(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
public Action:Command_Nextmap(client, args)
{
decl String:map[64];
GetNextMap(map, sizeof(map));
if(GetConVarInt(g_Cvar_TriggerShow))
{
PrintToChatAll("[SM] %t", "Next Map", map);
}
else
{
ReplyToCommand(client, "[SM] %t", "Next Map", map);
}
return Plugin_Handled;
}
public Action:Command_Say(client, args) public Action:Command_Say(client, args)
{ {
decl String:text[192], String:command[64]; decl String:text[192], String:command[64];
@ -189,6 +208,20 @@ public Action:Command_Say(client, args)
PrintToChat(client,"[SM] %t", "Current Map", map); PrintToChat(client,"[SM] %t", "Current Map", map);
} }
} }
else if (strcmp(text[startidx], "nextmap", false) == 0)
{
decl String:map[32];
GetNextMap(map, sizeof(map));
if(GetConVarInt(g_Cvar_TriggerShow))
{
PrintToChatAll("[SM] %t", "Next Map", map);
}
else
{
PrintToChat(client, "[SM] %t", "Next Map", map);
}
}
return Plugin_Continue; return Plugin_Continue;
} }

View File

@ -36,8 +36,6 @@
#include <sourcemod> #include <sourcemod>
#include "include/nextmap.inc" #include "include/nextmap.inc"
new Handle:g_Cvar_TriggerShow = INVALID_HANDLE;
public Plugin:myinfo = public Plugin:myinfo =
{ {
name = "Nextmap", name = "Nextmap",
@ -61,11 +59,6 @@ public OnPluginStart()
g_MapList = CreateArray(32); g_MapList = CreateArray(32);
RegConsoleCmd("say", Command_Say);
RegConsoleCmd("say_team", Command_Say);
RegConsoleCmd("nextmap", Command_Nextmap);
RegAdminCmd("sm_setnextmap", Command_SetNextmap, ADMFLAG_CHANGEMAP, "sm_setnextmap <map>"); RegAdminCmd("sm_setnextmap", Command_SetNextmap, ADMFLAG_CHANGEMAP, "sm_setnextmap <map>");
RegAdminCmd("sm_maphistory", Command_MapHistory, ADMFLAG_CHANGEMAP, "Shows the most recent maps played"); RegAdminCmd("sm_maphistory", Command_MapHistory, ADMFLAG_CHANGEMAP, "Shows the most recent maps played");
RegConsoleCmd("listmaps", Command_List); RegConsoleCmd("listmaps", Command_List);
@ -94,44 +87,6 @@ public OnConfigsExecuted()
{ {
FindAndSetNextMap(); FindAndSetNextMap();
} }
g_Cvar_TriggerShow = FindConVar("sm_trigger_show");
}
public Action:Command_Say(client, args)
{
decl String:text[192];
if (GetCmdArgString(text, sizeof(text)) < 1)
{
return Plugin_Continue;
}
new startidx;
if (text[strlen(text)-1] == '"')
{
text[strlen(text)-1] = '\0';
startidx = 1;
}
decl String:message[8];
BreakString(text[startidx], message, sizeof(message));
if (strcmp(message, "nextmap", false) == 0)
{
decl String:map[32];
GetNextMap(map, sizeof(map));
if(g_Cvar_TriggerShow != INVALID_HANDLE && GetConVarInt(g_Cvar_TriggerShow))
{
PrintToChatAll("[SM] %t", "Next Map", map);
}
else
{
PrintToChat(client, "[SM] %t", "Next Map", map);
}
}
return Plugin_Continue;
} }
public Action:Command_SetNextmap(client, args) public Action:Command_SetNextmap(client, args)
@ -174,24 +129,6 @@ public Action:Command_List(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
public Action:Command_Nextmap(client, args)
{
decl String:map[64];
GetNextMap(map, sizeof(map));
if(g_Cvar_TriggerShow != INVALID_HANDLE && GetConVarInt(g_Cvar_TriggerShow))
{
PrintToChatAll("[SM] %t", "Next Map", map);
}
else
{
ReplyToCommand(client, "[SM] %t", "Next Map", map);
}
return Plugin_Handled;
}
FindAndSetNextMap() FindAndSetNextMap()
{ {
if (ReadMapList(g_MapList, if (ReadMapList(g_MapList,

View File

@ -71,4 +71,10 @@
{ {
"en" "No timelimit for map" "en" "No timelimit for map"
} }
"Next Map"
{
"#format" "{1:s}"
"en" "Next Map: {1}"
}
} }

View File

@ -1,10 +1,5 @@
"Phrases" "Phrases"
{ {
"Next Map"
{
"#format" "{1:s}"
"en" "Next Map: {1}"
}
"Changed Next Map" "Changed Next Map"
{ {
"#format" "{1:s}" "#format" "{1:s}"