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

72 lines
2.1 KiB
C#
Raw Normal View History

2021-08-18 11:47:59 +02:00
using System.Linq;
using CoopServer;
namespace FirstGameMode
{
class Commands
{
[Command("hello")]
public static void HelloCommand(CommandContext ctx)
{
2021-08-26 17:01:32 +02:00
ctx.Client.SendChatMessage("Hello " + ctx.Client.Player.Username + " :)");
2021-08-18 11:47:59 +02:00
}
[Command("inrange")]
public static void InRangeCommand(CommandContext ctx)
{
2021-08-26 17:01:32 +02:00
if (ctx.Client.Player.IsInRangeOf(new LVector3(0f, 0f, 75f), 7f))
2021-08-18 11:47:59 +02:00
{
2021-08-26 17:01:32 +02:00
ctx.Client.SendChatMessage("You are in range! :)");
2021-08-18 11:47:59 +02:00
}
else
{
2021-08-26 17:01:32 +02:00
ctx.Client.SendChatMessage("You are not in range! :(");
2021-08-18 11:47:59 +02:00
}
}
[Command("online")]
public static void OnlineCommand(CommandContext ctx)
{
2021-08-26 17:01:32 +02:00
ctx.Client.SendChatMessage(API.GetAllClientsCount() + " player online!");
2021-08-18 11:47:59 +02:00
}
[Command("kick")]
public static void KickCommand(CommandContext ctx)
{
if (ctx.Args.Length < 2)
{
2021-08-26 17:01:32 +02:00
ctx.Client.SendChatMessage("Please use \"/kick <USERNAME> <REASON>\"");
2021-08-18 11:47:59 +02:00
return;
}
2021-08-26 17:01:32 +02:00
ctx.Client.Kick(ctx.Args.Skip(1).ToArray());
2021-08-18 11:47:59 +02:00
}
2021-08-20 17:28:13 +02:00
[Command("setweather")]
public static void SetWeatherCommand(CommandContext ctx)
{
int hours, minutes, seconds;
if (ctx.Args.Length < 3)
{
2021-08-26 17:01:32 +02:00
ctx.Client.SendChatMessage("Please use \"/setweather <HOURS> <MINUTES> <SECONDS>\"");
2021-08-20 17:28:13 +02:00
return;
}
else if (!int.TryParse(ctx.Args[0], out hours) || !int.TryParse(ctx.Args[1], out minutes) || !int.TryParse(ctx.Args[2], out seconds))
{
2021-08-26 17:01:32 +02:00
ctx.Client.SendChatMessage("Please use \"/setweather <NUMBER> <NUMBER> <NUMBER>\"");
2021-08-20 17:28:13 +02:00
return;
}
2021-08-26 17:01:32 +02:00
ctx.Client.SendNativeCall(0x47C3B5848C3E45D8, hours, minutes, seconds);
2021-08-20 17:28:13 +02:00
}
[Command("upp")]
public static void UpdatePlayerPositionCommand(CommandContext ctx)
{
Main.ShowPlayerPosition = !Main.ShowPlayerPosition;
}
2021-08-18 11:47:59 +02:00
}
}