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
+34 -1
View File
@@ -71,6 +71,7 @@ public OnPluginStart()
RegConsoleCmd("say_team", Command_Say);
RegConsoleCmd("timeleft", Command_Timeleft);
RegConsoleCmd("nextmap", Command_Nextmap);
HookConVarChange(g_Cvar_TimeleftInterval, ConVarChange_TimeleftInterval);
@@ -115,6 +116,24 @@ public Action:Command_Timeleft(client, args)
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)
{
decl String:text[192], String:command[64];
@@ -188,7 +207,21 @@ public Action:Command_Say(client, args)
{
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;
}
+1 -64
View File
@@ -36,8 +36,6 @@
#include <sourcemod>
#include "include/nextmap.inc"
new Handle:g_Cvar_TriggerShow = INVALID_HANDLE;
public Plugin:myinfo =
{
name = "Nextmap",
@@ -60,11 +58,6 @@ public OnPluginStart()
LoadTranslations("nextmap.phrases");
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_maphistory", Command_MapHistory, ADMFLAG_CHANGEMAP, "Shows the most recent maps played");
@@ -94,44 +87,6 @@ public OnConfigsExecuted()
{
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)
@@ -173,25 +128,7 @@ public Action:Command_List(client, args)
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()
{
if (ReadMapList(g_MapList,