Example #1
0
        public void switchgroup(Client player, int id)
        {
            if (id > 0)
            {
                AccountController account = player.getData("ACCOUNT");
                if (account == null)
                {
                    return;
                }
                if (!AdminController.AdminRankCheck("switchgroup", account))
                {
                    return;
                }

                GroupController GroupController = EntityManager.GetGroup(id);
                if (GroupController == null)
                {
                    player.sendChatMessage("~r~ERROR: ~w~You specified an invalid group.");
                }
                else
                {
                    account.CharacterController.AddGroup(GroupController.Group, true);
                    account.CharacterController.SetActiveGroup(GroupController.Group);
                    API.shared.sendChatMessageToPlayer(player, "You joined: " + GroupController.Group.Name);
                }
            }
        }
Example #2
0
        public void editgroup(Client player, int id, string name, GroupType type, GroupExtraType extraType)
        {
            if (id > 0)
            {
                AccountController account = player.getData("ACCOUNT");
                if (account == null)
                {
                    return;
                }
                if (!AdminController.AdminRankCheck("editgroup", account))
                {
                    return;
                }

                GroupController GroupController = EntityManager.GetGroup(id);
                if (GroupController == null)
                {
                    player.sendChatMessage("~r~ERROR: ~w~You specified an invalid group.");
                }
                else
                {
                    GroupController.Group.Name = name;
                    GroupController.Group.Type = type;

                    GroupController.Group.ExtraType = extraType;
                    API.sendChatMessageToPlayer(player, "You successfully edited GroupID " + id);
                    ContextFactory.Instance.SaveChanges();
                }
            }
        }