Пример #1
0
        void cmdOwner(NetUser netUser, string command, string[] args)
        {
            var username = netUser.displayName.ToString();
            var Id       = netUser.userID.ToString();

            if (!(netUser.CanAdmin() || permission.UserHasPermission(Id, permissionCanOwner)))
            {
                rust.SendChatMessage(netUser, lang.GetMessage("ChatTag", this, Id), lang.GetMessage("NoPermission", this, Id));
                return;
            }
            if (Profile.owner.ContainsKey(Id))
            {
                rust.BroadcastChat(lang.GetMessage("ChatTag", this, Id), string.Format(lang.GetMessage("OffBroadcast", this, Id), username));
                Profile.owner.Remove(Id);
                netUser.SetAdmin(false);
                SaveData();
            }
            else
            {
                rust.BroadcastChat(lang.GetMessage("ChatTag", this, Id), string.Format(lang.GetMessage("OnBroadcast", this, Id), username));
                Profile.owner.Add(Id, username);
                netUser.SetAdmin(true);
                SaveData();
            }
            return;
        }
Пример #2
0
        void cmdLogin(NetUser netUser, string command, string[] args)
        {
            var Id       = netUser.userID.ToString();
            var username = netUser.displayName.ToString();

            if (args.Length == 0)
            {
                rust.SendChatMessage(netUser, lang.GetMessage("ChatTag", this, Id), lang.GetMessage("SyntaxLogin", this, Id));
                return;
            }
            string rcon = (args[0]);

            if (rcon == permissionCanRcon)
            {
                foreach (PlayerClient player in PlayerClient.All)
                {
                    var playerId = player.userID.ToString();
                    netUser.SetAdmin(true);
                    if (netUser.CanAdmin() || Profile.owner.ContainsKey(playerId) || Profile.admin.ContainsKey(playerId) || Profile.owner.ContainsKey(playerId) || Profile.mod.ContainsKey(playerId) || Profile.helper.ContainsKey(playerId))
                    {
                        rust.SendChatMessage(player.netUser, lang.GetMessage("ChatTag", this, Id), string.Format(lang.GetMessage("Login", this, Id), username));
                    }
                    return;
                }
            }
            else
            {
                rust.BroadcastChat(lang.GetMessage("ChatTag", this, Id), string.Format(lang.GetMessage("KickRcon", this, Id), username));
                netUser.Kick(NetError.Facepunch_Kick_Violation, true);
            }
        }