IW4M-Admin/Plugins/IW4ScriptCommands/Plugin.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

47 lines
1.3 KiB
C#

using SharedLibraryCore;
using SharedLibraryCore.Interfaces;
using System.Threading.Tasks;
namespace IW4ScriptCommands
{
public class Plugin : IPlugin
{
public string Name => "IW4 Script Commands";
public float Version => 1.0f;
public string Author => "RaidMax";
public async Task OnEventAsync(GameEvent E, Server S)
{
if (E.Type == GameEvent.EventType.Start)
{
await S.SetDvarAsync("sv_iw4madmin_serverid", S.EndPoint);
}
if (E.Type == GameEvent.EventType.Warn)
{
var cmd = new ScriptCommand()
{
ClientNumber = E.Target.ClientNumber,
CommandName = "alert",
CommandArguments = new[]
{
"Warning",
"ui_mp_nukebomb_timer",
E.Data
}
};
// notifies the player ingame of the warning
await cmd.Execute(S);
}
}
public Task OnLoadAsync(IManager manager) => Task.CompletedTask;
public Task OnTickAsync(Server S) => Task.CompletedTask;
public Task OnUnloadAsync() => Task.CompletedTask;
}
}