Exemple #1
0
        public async void Execute(IRocketPlayer caller, string[] command)
        {
            var player = (UnturnedPlayer)caller;

            if (R.Permissions.GetGroup(Instance.Configuration.Instance.RewardGroup) == null)
            {
                UnturnedChat.Say(caller, Instance.Translate("group_not_found"), Color.red);
                return;
            }

            switch (command.Length)
            {
            case 0:
                player.Player.sendBrowserRequest(Instance.Configuration.Instance.BrowserRequestDesc, $"https://vk.com/{Instance.Configuration.Instance.VkGroupId}");
                break;

            case 1:

                if (R.Permissions.GetGroup(Instance.Configuration.Instance.RewardGroup).Members.Contains(player.CSteamID.ToString()))
                {
                    UnturnedChat.Say(caller, Instance.Translate("has_permission"), Color.yellow);
                    return;
                }

                var vk = await RequestUtil.GetPlayerVk(command[0]);


                if (vk == null)
                {
                    UnturnedChat.Say(caller, Instance.Translate("invalid_id"), Color.red);
                    return;
                }

                var newReg = DataBaseUtil.GetOrAddCode(player.CSteamID.m_SteamID, vk);

                Reg(caller, vk, newReg);

                break;

            default:
                UnturnedChat.Say(caller, Instance.Translate("command_invalid", "/Vk [Ваш ID Vk]"), Color.red);
                break;
            }
        }