diff --git a/plugins/basetriggers.sp b/plugins/basetriggers.sp index 4d731fbb..8cac49fb 100644 --- a/plugins/basetriggers.sp +++ b/plugins/basetriggers.sp @@ -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; } diff --git a/plugins/nextmap.sp b/plugins/nextmap.sp index 6f76a184..f2dd65a7 100644 --- a/plugins/nextmap.sp +++ b/plugins/nextmap.sp @@ -36,8 +36,6 @@ #include #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 "); 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, diff --git a/translations/basetriggers.phrases.txt b/translations/basetriggers.phrases.txt index 9dce2b70..05b3bf49 100644 --- a/translations/basetriggers.phrases.txt +++ b/translations/basetriggers.phrases.txt @@ -7,7 +7,7 @@ "Thetime" { - "#format" "{1:s}" + "#format" "{1:s}" "en" "The current server time is {1}" } @@ -23,42 +23,42 @@ "Current Map" { - "#format" "{1:s}" + "#format" "{1:s}" "en" "The current map is {1}." } "WinLimitAppend" { - "#format" "{1:i},{2:s}" + "#format" "{1:i},{2:s}" "en" ", or change map after a team wins {1} round{2}" } "WinLimit" { - "#format" "{1:i},{2:s}" + "#format" "{1:i},{2:s}" "en" "Map will change after a team wins {1} round{2}" } "MaxRoundsAppend" { - "#format" "{1:i},{2:s}" + "#format" "{1:i},{2:s}" "en" ", or change map after {1} round{2}" } "MaxRounds" { - "#format" "{1:i},{2:s}" + "#format" "{1:i},{2:s}" "en" "Map will change after {1} round{2}" } "FragLimitAppend" { - "#format" "{1:i},{2:s}" + "#format" "{1:i},{2:s}" "en" ", or change map after player reaches {1} frag{2}" } "FragLimit" { - "#format" "{1:i},{2:s}" + "#format" "{1:i},{2:s}" "en" "Map will change after a player reaches {1} frag{2}" } @@ -71,4 +71,10 @@ { "en" "No timelimit for map" } + + "Next Map" + { + "#format" "{1:s}" + "en" "Next Map: {1}" + } } diff --git a/translations/nextmap.phrases.txt b/translations/nextmap.phrases.txt index 794a215a..4eaad73e 100644 --- a/translations/nextmap.phrases.txt +++ b/translations/nextmap.phrases.txt @@ -1,13 +1,8 @@ -"Phrases" -{ - "Next Map" - { - "#format" "{1:s}" - "en" "Next Map: {1}" - } - "Changed Next Map" - { - "#format" "{1:s}" - "en" "Changed nextmap to \"{1}\"." - } -} +"Phrases" +{ + "Changed Next Map" + { + "#format" "{1:s}" + "en" "Changed nextmap to \"{1}\"." + } +}