Skip to content

Commit fe10145

Browse files
committed
Add workshop map command.
1 parent f639c0f commit fe10145

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

BasicAdmin/BasicAdmin.cs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace BasicAdmin;
1111

12-
public class BasicAdmin : BasePlugin, IPluginConfig<BasicAdminConfig>
12+
public sealed class BasicAdmin : BasePlugin, IPluginConfig<BasicAdminConfig>
1313
{
1414
public override string ModuleName => "BasicAdmin";
1515
public override string ModuleAuthor => "livevilog";
@@ -47,6 +47,28 @@ public void OnMapCommand(CCSPlayerController? caller, CommandInfo info)
4747
});
4848
}
4949

50+
[ConsoleCommand("css_wsmap", "Change map.")]
51+
[ConsoleCommand("css_workshop", "Change map.")]
52+
[CommandHelper(1, "<mapid>")]
53+
[RequiresPermissions("@css/changemap")]
54+
public void OnWorkshopMapCommand(CCSPlayerController? caller, CommandInfo info)
55+
{
56+
var map = info.GetArg(1);
57+
58+
if (!Server.IsMapValid(map))
59+
{
60+
info.ReplyToCommand(FormatMessage($"Map {map} not found."));
61+
return;
62+
}
63+
64+
Server.PrintToChatAll(FormatAdminMessage($"Changing map to {map}..."));
65+
66+
AddTimer(3f, () =>
67+
{
68+
Server.ExecuteCommand($"ds_workshop_changelevel {map}");
69+
});
70+
}
71+
5072
[ConsoleCommand("css_kick", "Kick a player from the server.")]
5173
[CommandHelper(1, "<#userid or name> [reason]")]
5274
[RequiresPermissions("@css/kick")]
@@ -204,7 +226,7 @@ public void OnAdminHudSayCommand(CCSPlayerController? caller, CommandInfo info)
204226
0, 0, 0, 0);
205227
}
206228

207-
[ConsoleCommand("css_extend", "Respawn a dead player.")]
229+
[ConsoleCommand("css_extend", "Extend map timelimit.")]
208230
[CommandHelper(1, "<minutes>")]
209231
[RequiresPermissions("@css/changemap")]
210232
public void OnExtendCommand(CCSPlayerController? caller, CommandInfo info)

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
## Available commands
1313
* `css_map`
1414
* requires `@css/changemap` flag
15+
* `css_workshop`
16+
* `css_wsmap` (alias)
17+
* requires `@css/changemap` flag
1518
* `css_kick`
1619
* requires `@css/kick` flag
1720
* `css_slay`

0 commit comments

Comments
 (0)