chat_command_map_mode 1.0.0

This commit is contained in:
Resxt 2023-02-16 04:03:33 +01:00
parent da52be9cc7
commit 1ac9e89578
2 changed files with 76 additions and 0 deletions

View File

@ -24,6 +24,20 @@ Also note that this script doesn't provide any command on its own. You must inst
- Permissions/ranks to restrict some commands to a certain type of players (admin, VIP etc.)
- Configurable text colors/accent. As of now the majority of the text will be white
## chat_command_map_mode.gsc
3 related commands in one file:
- Change map
- Change mode
- Change map and mode
| Name | Description | Arguments expected | Example |
|---|---|---|---|
| map | Changes the map on the server | (1) the map codename | `!map mp_dome` |
| mode | Charges a new DSR/mode on the server and restarts the current map | (1) the DSR file name, found in the `admin` folder of your game | `!mode FFA_default` |
| mapmode | Charges a new DSR/mode on the server and rotates to the requested map | (1) the map codename (2) the DSR file name, found in the `admin` folder of your game | `!mapmode mp_seatown TDM_default` |
## chat_command_suicide.gsc
The player who runs the command dies.

View File

@ -0,0 +1,62 @@
#include scripts\chat_commands;
Init()
{
CreateCommand(level.commands_servers_ports, "map", "function", ::ChangeMapCommand, ["Example: " + level.commands_prefix + "map mp_dome"]);
CreateCommand(level.commands_servers_ports, "mode", "function", ::ChangeModeCommand, ["Example: " + level.commands_prefix + "mode FFA_default"]);
CreateCommand(level.commands_servers_ports, "mapmode", "function", ::ChangeMapAndModeCommand, ["Example: " + level.commands_prefix + "mapmode mp_seatown TDM_default"]);
}
/* Command section */
ChangeMapCommand(args)
{
if (args.size < 1)
{
return NotEnoughArgsError(1);
}
ChangeMap(args[0]);
}
ChangeModeCommand(args)
{
if (args.size < 1)
{
return NotEnoughArgsError(1);
}
ChangeMode(args[0], true);
}
ChangeMapAndModeCommand(args)
{
if (args.size < 2)
{
return NotEnoughArgsError(2);
}
ChangeMode(args[1], false);
ChangeMap(args[0]);
}
/* Logic section */
ChangeMap(mapName)
{
cmdexec("map " + mapName);
}
ChangeMode(modeName, restart)
{
cmdexec("load_dsr " + modeName + ";");
if (restart)
{
cmdexec("map_restart");
}
}