IW4M-Admin/Plugins/IW4ScriptCommands/ScriptCommand.cs
RaidMax 9e345752f2 update parser selection menu text during setup
update IW4 script commands gsc and plugin to give base example
fix issue with new account alias linking (I think)
2020-01-21 18:08:18 -06:00

37 lines
1.1 KiB
C#

using SharedLibraryCore;
using System.Linq;
using System.Threading.Tasks;
namespace IW4ScriptCommands
{
/// <summary>
/// Contains basic properties for command information read by gsc
/// </summary>
class ScriptCommand
{
/// <summary>
/// Name of the command to execute
/// </summary>
public string CommandName { get; set; }
/// <summary>
/// Target client number
/// </summary>
public int ClientNumber { get; set; }
/// <summary>
/// Arguments for the script function itself
/// </summary>
public string[] CommandArguments { get; set; } = new string[0];
public override string ToString() => string.Join(";", new[] { CommandName, ClientNumber.ToString() }.Concat(CommandArguments).Select(_arg => _arg.Replace(";", "")));
/// <summary>
/// Executes the command
/// </summary>
/// <param name="server">server to execute the command on</param>
/// <returns></returns>
public async Task Execute(Server server) => await server.SetDvarAsync("sv_iw4madmin_command", ToString());
}
}