Files
RAGECOOP-V/FirstGameMod/FirstGameMode/Commands.cs

53 lines
1.7 KiB
C#
Raw Normal View History

2021-09-29 14:34:22 +02:00
using CoopServer;
2021-09-29 15:51:28 +02:00
using System.Collections.Generic;
2021-08-18 11:47:59 +02:00
namespace FirstGameMode
{
class Commands
{
2021-09-29 14:34:22 +02:00
[Command("set")]
public static void TimeCommand(CommandContext ctx)
2021-08-18 11:47:59 +02:00
{
2021-09-29 14:34:22 +02:00
if (ctx.Args.Length < 1)
2021-08-18 11:47:59 +02:00
{
2021-09-29 14:34:22 +02:00
ctx.Client.SendChatMessage("Please use \"/set <OPTION> ...\"");
2021-08-18 11:47:59 +02:00
return;
}
2021-09-29 14:34:22 +02:00
else if (ctx.Args.Length < 2)
2021-08-20 17:28:13 +02:00
{
2021-09-29 14:34:22 +02:00
ctx.Client.SendChatMessage($"Please use \"/set {ctx.Args[0]} ...\"");
2021-08-20 17:28:13 +02:00
return;
}
2021-09-29 14:34:22 +02:00
switch (ctx.Args[0])
2021-08-20 17:28:13 +02:00
{
2021-09-29 14:34:22 +02:00
case "time":
int hours, minutes, seconds;
if (ctx.Args.Length < 4)
{
ctx.Client.SendChatMessage("Please use \"/set time <HOURS> <MINUTES> <SECONDS>\"");
return;
}
else if (!int.TryParse(ctx.Args[1], out hours) || !int.TryParse(ctx.Args[2], out minutes) || !int.TryParse(ctx.Args[3], out seconds))
{
ctx.Client.SendChatMessage($"Please use \"/set time <NUMBER> <NUMBER> <NUMBER>\"");
return;
}
ctx.Client.SendNativeCall(0x47C3B5848C3E45D8, hours, minutes, seconds);
break;
2021-08-20 17:28:13 +02:00
}
}
2021-09-29 15:51:28 +02:00
[Command("inrange")]
public static void InRangeCommand(CommandContext ctx)
{
List<string> list = new();
API.GetAllClients().FindAll(x => x.Player.IsInRangeOf(ctx.Client.Player.Position, 15f)).ForEach(x => list.Add(x.Player.Username));
ctx.Client.SendChatMessage(string.Join(", ", list.ToArray()));
}
2021-08-18 11:47:59 +02:00
}
}