public void OnCommand(ICommandExecutor executor, string label, ReadOnlySpan <string> args)
        {
            if (executor is ClientSession session)
            {
                MultiplayerMatchSession matchSession = session.MultiplayerMatchSession;
                if (matchSession != null && matchSession.Match != null)
                {
                    matchSession.Match.Broadcaster = !matchSession.Match.Broadcaster;

                    if (matchSession.Match.Broadcaster)
                    {
                        executor.SendMessage("Broadcaster has been signed to duty!");
                    }
                    else
                    {
                        executor.SendMessage("Broadcaster has been fired, what a shame!");
                    }
                }
                else
                {
                    executor.SendMessage("You need to be in match to use this command");
                }
            }
            else
            {
                executor.SendMessage("This command may only be executed by client session");
            }
        }
Ejemplo n.º 2
0
    public void OnCommand(ICommandExecutor executor, string label, ReadOnlySpan <string> args)
    {
        if (executor is ClientSession session)
        {
            if (args.Length != 1)
            {
                executor.SendMessage("Usage: /spawnaliens [amount]");

                return;
            }

            if (!uint.TryParse(args[0], out uint amount))
            {
                executor.SendMessage("The amount must be unsigned integer");

                return;
            }

            MultiplayerMatchSession matchSession = session.MultiplayerMatchSession;
            if (matchSession != null && matchSession.Match != null)
            {
                matchSession.Match.SendPacket(new SpawnAliensOutgoingPacket(amount, new Random().Next(26487)));
            }
            else
            {
                executor.SendMessage("You need to be in match to use this command");
            }
        }
        else
        {
            executor.SendMessage("This command may only be executed by client session");
        }
    }
    public void OnCommand(ICommandExecutor executor, string label, ReadOnlySpan <string> args)
    {
        if (executor is ClientSession session)
        {
            if (args.Length != 2)
            {
                executor.SendMessage("Usage: /fakeprize [category] [id]");

                return;
            }

            if (!uint.TryParse(args[1], out uint id))
            {
                executor.SendMessage("The id must be unsigned integer");

                return;
            }

            MultiplayerMatchSession matchSession = session.MultiplayerMatchSession;
            if (matchSession != null && matchSession.Match != null)
            {
                ;
                matchSession.Match.SendPacket(new PrizeOutgoingMessage(new MatchPrize(args[0], id), "available"));
            }
            else
            {
                executor.SendMessage("You need to be in match to use this command");
            }
        }
        else
        {
            executor.SendMessage("This command may only be executed by client session");
        }
    }
Ejemplo n.º 4
0
        public void OnCommand(ICommandExecutor executor, string label, ReadOnlySpan <string> args)
        {
            if (executor is ClientSession session)
            {
                if (args.Length != 1)
                {
                    executor.SendMessage("Usage: /addhat [hat]");

                    return;
                }

                Hat hat;
                if (uint.TryParse(args[0], out uint hatId))
                {
                    hat = (Hat)hatId;
                }
                else if (!Enum.TryParse(args[0], ignoreCase: true, out hat))
                {
                    executor.SendMessage($"Unable to find part with name {args[0]}");
                }

                MultiplayerMatchSession matchSession = session.MultiplayerMatchSession;
                if (matchSession != null && matchSession.Match != null && matchSession.MatchPlayer != null)
                {
                    matchSession.Match.AddHatToPlayer(matchSession.MatchPlayer, hat, session.UserData.CurrentHatColor, spawned: true);
                }
                else
                {
                    executor.SendMessage("You need to be in match to use this command");
                }
            }
            else
            {
                executor.SendMessage("This command may only be executed by client session");
            }
        }