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-18 12:47:36 +02:00
|
|
|
|
API.SendChatMessageToPlayer(ctx.Player.Username, "Hello " + ctx.Player.Username + " :)");
|
2021-08-18 11:47:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Command("inrange")]
|
|
|
|
|
public static void InRangeCommand(CommandContext ctx)
|
|
|
|
|
{
|
|
|
|
|
if (ctx.Player.Ped.IsInRangeOf(new LVector3(0f, 0f, 75f), 7f))
|
|
|
|
|
{
|
2021-08-18 12:47:36 +02:00
|
|
|
|
API.SendChatMessageToPlayer(ctx.Player.Username, "You are in range! :)");
|
2021-08-18 11:47:59 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-08-18 12:47:36 +02:00
|
|
|
|
API.SendChatMessageToPlayer(ctx.Player.Username, "You are not in range! :(");
|
2021-08-18 11:47:59 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Command("online")]
|
|
|
|
|
public static void OnlineCommand(CommandContext ctx)
|
|
|
|
|
{
|
2021-08-18 12:47:36 +02:00
|
|
|
|
API.SendChatMessageToPlayer(ctx.Player.Username, API.GetAllPlayersCount() + " 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-18 12:47:36 +02:00
|
|
|
|
API.SendChatMessageToPlayer(ctx.Player.Username, "Please use \"/kick <USERNAME> <REASON>\"");
|
2021-08-18 11:47:59 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-18 12:47:36 +02:00
|
|
|
|
API.KickPlayerByUsername(ctx.Args[0], ctx.Args.Skip(1).ToArray());
|
2021-08-18 11:47:59 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|