2020-01-21 19:08:18 -05:00
|
|
|
|
using SharedLibraryCore;
|
2018-04-28 01:22:18 -04:00
|
|
|
|
using SharedLibraryCore.Interfaces;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace IW4ScriptCommands
|
|
|
|
|
{
|
2020-01-21 19:08:18 -05:00
|
|
|
|
public class Plugin : IPlugin
|
2018-04-28 01:22:18 -04:00
|
|
|
|
{
|
|
|
|
|
public string Name => "IW4 Script Commands";
|
|
|
|
|
|
|
|
|
|
public float Version => 1.0f;
|
|
|
|
|
|
|
|
|
|
public string Author => "RaidMax";
|
|
|
|
|
|
2020-01-21 19:08:18 -05:00
|
|
|
|
public async Task OnEventAsync(GameEvent E, Server S)
|
2018-06-05 17:31:36 -04:00
|
|
|
|
{
|
2018-10-25 09:14:39 -04:00
|
|
|
|
if (E.Type == GameEvent.EventType.Start)
|
|
|
|
|
{
|
2020-01-21 19:08:18 -05:00
|
|
|
|
await S.SetDvarAsync("sv_iw4madmin_serverid", S.EndPoint);
|
2018-10-25 09:14:39 -04:00
|
|
|
|
}
|
2018-09-02 22:25:09 -04:00
|
|
|
|
|
|
|
|
|
if (E.Type == GameEvent.EventType.Warn)
|
2018-06-05 17:31:36 -04:00
|
|
|
|
{
|
2020-01-21 19:08:18 -05:00
|
|
|
|
var cmd = new ScriptCommand()
|
2018-06-05 17:31:36 -04:00
|
|
|
|
{
|
2018-09-02 22:25:09 -04:00
|
|
|
|
ClientNumber = E.Target.ClientNumber,
|
2020-01-21 19:08:18 -05:00
|
|
|
|
CommandName = "alert",
|
|
|
|
|
CommandArguments = new[]
|
2018-09-02 22:25:09 -04:00
|
|
|
|
{
|
|
|
|
|
"Warning",
|
|
|
|
|
"ui_mp_nukebomb_timer",
|
|
|
|
|
E.Data
|
|
|
|
|
}
|
2020-01-21 19:08:18 -05:00
|
|
|
|
};
|
|
|
|
|
// notifies the player ingame of the warning
|
|
|
|
|
await cmd.Execute(S);
|
2018-06-05 17:31:36 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-28 01:22:18 -04:00
|
|
|
|
|
|
|
|
|
public Task OnLoadAsync(IManager manager) => Task.CompletedTask;
|
|
|
|
|
|
|
|
|
|
public Task OnTickAsync(Server S) => Task.CompletedTask;
|
|
|
|
|
|
|
|
|
|
public Task OnUnloadAsync() => Task.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
}
|