diff --git a/plugins/basecommands.sp b/plugins/basecommands.sp index d273b9e1..a9c593bc 100644 --- a/plugins/basecommands.sp +++ b/plugins/basecommands.sp @@ -35,8 +35,49 @@ public Plugin:myinfo = public OnPluginStart() { - LoadTranslations("core.cfg"); + LoadTranslations("common.cfg"); RegAdminCmd("sm_kick", Command_Kick, ADMFLAG_KICK, "sm_kick <#userid|name> [reason]"); + RegAdminCmd("sm_map", Command_Map, ADMFLAG_CHANGEMAP, "sm_map "); +} + +public Action:Command_Map(client, args) +{ + if (args < 1) + { + ReplyToCommand(client, "[SM] Usage: sm_map "); + return Plugin_Handled; + } + + new String:map[64]; + GetCmdArg(1, map, sizeof(map)); + + if (!IsMapValid(map)) + { + ReplyToCommand(client, "[SM] %t", "Map was not found", map); + return Plugin_Handled; + } + + LogMessage("\"%L\" changed map to \"%s\"", client, map); + ShowActivity(client, "%t", "Changing map", map); + ReplyToCommand(client, "%t", "Changing map", map); + + new Handle:dp + CreateDataTimer(3.0, Timer_ChangeMap, dp); + WritePackString(dp, map); + + return Plugin_Handled; +} + +public Action:Timer_ChangeMap(Handle:timer, Handle:dp) +{ + new String:map[65]; + + ResetPack(dp); + ReadPackString(dp, map, sizeof(map)); + + ServerCommand("changelevel \"%s\"", map); + + return Plugin_Stop; } public Action:Command_Kick(client, args) @@ -86,7 +127,7 @@ public Action:Command_Kick(client, args) ServerCommand("kickid %d \"%s\"", userid, reason); } - ReplyToCommand(client, "[SM] Client \"%s\" kicked.", name); + ReplyToCommand(client, "[SM] %t", "Client kicked", name); return Plugin_Handled; } diff --git a/translations/common.cfg b/translations/common.cfg new file mode 100644 index 00000000..8bb785c0 --- /dev/null +++ b/translations/common.cfg @@ -0,0 +1,37 @@ +"Phrases" +{ + "No matching client" + { + "en" "No matching client was found." + } + + "More than one client matches" + { + "#format" "{1:s}" + "en" "More than one client matches the pattern '{1}'" + } + + "Kicked player" + { + "#format" "{1:s}" + "en" "Kicked player '{1}'" + } + + "Client kicked" + { + "#format" "{1:s}" + "en" "Client '{1}' kicked." + } + + "Changing map" + { + "#format" "{1:s}" + "en" "Changing map to {1}..." + } + + "Map was not found" + { + "#format" "{1:s}" + "en" "Map {1} was not found." + } +} diff --git a/translations/core.cfg b/translations/core.cfg index 43841207..f19140de 100644 --- a/translations/core.cfg +++ b/translations/core.cfg @@ -20,23 +20,6 @@ "en" "Exit" } - "No matching client" - { - "en" "No matching client was found." - } - - "More than one client matches" - { - "#format" "{1:s}" - "en" "More than one client matches the pattern '{1}'" - } - - "Kicked player" - { - "#format" "{1:s}" - "en" "Kicked player '{1}'" - } - "Flooding the server" { "en" "You are flooding the server!"