void cmdClose(NetUser netUser, string command, string[] args) { ulong netUserID = netUser.userID; if (!(netUser.CanAdmin() || permission.UserHasPermission(netUserID.ToString(), permissionCanClose))) { rust.Notice(netUser, lang.GetMessage("NoPermission", this), lang.GetMessage("FailureIcon", this)); return; } if (args.Length == 0 || args == null) { rust.Notice(netUser, lang.GetMessage("InvalidSyntax", this), lang.GetMessage("FailureIcon", this)); return; } NetUser targetUser = rust.FindPlayer(args[0]); if (targetUser == null) { rust.Notice(netUser, lang.GetMessage("NoPlayersFound", this), lang.GetMessage("FailureIcon", this)); return; } rust.RunClientCommand(targetUser, "quit"); rust.Notice(netUser, $"{targetUser.displayName}{lang.GetMessage("SuccessCloseNotice", this)}", lang.GetMessage("SuccessIcon", this)); Puts($"{targetUser.displayName}{lang.GetMessage("SuccessCloseNotice", this)}"); return; }
void cmdBring(NetUser netUser, string command, string[] args) { ulong netUserID = netUser.userID; if (!(netUser.CanAdmin() || permission.UserHasPermission(netUserID.ToString(), permissionCanTeleport))) { rust.Notice(netUser, lang.GetMessage("NoPermission", this), lang.GetMessage("FailureIcon", this)); return; } if (args.Length == 0 || args.Length > 1 || args == null) { rust.Notice(netUser, lang.GetMessage("InvalidSyntax", this), lang.GetMessage("FailureIcon", this)); return; } NetUser targetUser = rust.FindPlayer(args[0]); if (targetUser == null) { rust.Notice(netUser, lang.GetMessage("NoPlayersFound", this), lang.GetMessage("FailureIcon", this)); return; } serverManagement.TeleportPlayerToPlayer(targetUser.playerClient.netPlayer, netUser.playerClient.netPlayer); rust.Notice(netUser, $"{targetUser.displayName} {lang.GetMessage("SuccessBringNotice", this)}", lang.GetMessage("SuccessIcon", this)); rust.BroadcastChat(lang.GetMessage("ChatPrefix", this), $"{targetUser.displayName} {lang.GetMessage("SuccessBringBroadcast", this)} {netUser.displayName}."); Puts($"{targetUser.displayName} {lang.GetMessage("SuccessBringBroadcast", this)} {netUser.displayName}."); return; }
void cmdInvisible(NetUser netUser, string command, string[] args) { ulong netUserID = netUser.userID; if (!(netUser.CanAdmin() || permission.UserHasPermission(netUserID.ToString(), permissionCanSpawnInvisibleSuit))) { rust.Notice(netUser, lang.GetMessage("NoPermission", this), lang.GetMessage("FailureIcon", this)); return; } ItemDataBlock helmet = DatablockDictionary.GetByName("Invisible Helmet"); ItemDataBlock vest = DatablockDictionary.GetByName("Invisible Vest"); ItemDataBlock pants = DatablockDictionary.GetByName("Invisible Pants"); ItemDataBlock boots = DatablockDictionary.GetByName("Invisible Boots"); Inventory inventory = netUser.playerClient.rootControllable.idMain.GetComponent <Inventory>(); inventory.AddItemAmount(helmet, 1); inventory.AddItemAmount(vest, 1); inventory.AddItemAmount(pants, 1); inventory.AddItemAmount(boots, 1); rust.Notice(netUser, lang.GetMessage("SuccessInvisibleNotice", this), lang.GetMessage("SuccessIcon", this)); Puts($"{netUser.displayName} {lang.GetMessage("SuccessInvisibleBroadcast", this)}"); return; }
void cmdUnban(NetUser netUser, string command, string[] args) { ulong netUserID = netUser.userID; if (!(netUser.CanAdmin() || permission.UserHasPermission(netUserID.ToString(), permissionCanBan))) { rust.Notice(netUser, lang.GetMessage("NoPermission", this), lang.GetMessage("FailureIcon", this)); return; } if (args.Length == 0 || args == null) { rust.Notice(netUser, lang.GetMessage("InvalidSyntax", this), lang.GetMessage("FailureIcon", this)); return; } string targetUserIDString = args[0]; if (targetUserIDString.Length != 17) { rust.Notice(netUser, lang.GetMessage("InvalidSteamID", this), lang.GetMessage("FailureIcon", this)); return; } rust.RunServerCommand($"removeid {targetUserIDString}"); rust.Notice(netUser, $"{lang.GetMessage("SuccessUnbanNotice", this)} {targetUserIDString}.", lang.GetMessage("SuccessIcon", this)); rust.BroadcastChat(lang.GetMessage("ChatPrefix", this), $"{targetUserIDString} {lang.GetMessage("SuccessUnbanBroadcast", this)}"); Puts($"{targetUserIDString} {lang.GetMessage("SuccessUnbanBroadcast", this)}"); return; }
private void OnPlayerConnected(NetUser netUser) { // Do permission stuff if (permission.IsLoaded) { var id = netUser.userID.ToString(); // Update stored name permission.UpdateNickname(id, netUser.displayName); // Add player to default group if (!permission.UserHasGroup(id, DefaultGroups[0])) { permission.AddUserGroup(id, DefaultGroups[0]); } // Add player to admin group if admin if (netUser.CanAdmin() && !permission.UserHasGroup(id, DefaultGroups[2])) { permission.AddUserGroup(id, DefaultGroups[2]); } } // Let covalence know covalence.PlayerManager.NotifyPlayerConnect(netUser); Interface.Call("OnUserConnected", covalence.PlayerManager.FindPlayer(netUser.userID.ToString())); }
bool IsHelper(NetUser netUser) { var userid = netUser.userID.ToString(); if (netUser.CanAdmin()) { return(true); } if (Profile.owner.ContainsKey(userid)) { return(true); } if (Profile.admin.ContainsKey(userid)) { return(true); } if (Profile.mod.ContainsKey(userid)) { return(true); } if (Profile.helper.ContainsKey(userid)) { return(true); } return(false); }
void cmdGood(NetUser netUser, string command, string[] args) { var username = netUser.displayName.ToString(); var Id = netUser.userID.ToString(); bool IsAdmin = (bool)AdminControl?.Call("IsAdmin", netUser); { if (!(netUser.CanAdmin() || IsAdmin || permission.UserHasPermission(Id, permissionCanGod))) { rust.SendChatMessage(netUser, lang.GetMessage("ChatTag", this), lang.GetMessage("NoPermission", this)); return; } if (Good.Contains(Id)) { rust.SendChatMessage(netUser, lang.GetMessage("ChatTag", this, Id), lang.GetMessage("GoodOff", this, Id)); netUser.playerClient.rootControllable.rootCharacter.takeDamage.SetGodMode(false); Good.Remove(Id); return; } else { rust.SendChatMessage(netUser, lang.GetMessage("ChatTag", this, Id), lang.GetMessage("GoodOn", this, Id)); netUser.playerClient.rootControllable.rootCharacter.takeDamage.SetGodMode(true); Good.Add(Id); return; } } }
void cmdUngod(NetUser netUser, string command, string[] args) { var Id = netUser.userID.ToString(); var username = netUser.displayName.ToString(); bool IsAdmin = (bool)AdminControl?.Call("IsAdmin", netUser); { if (!(netUser.CanAdmin() || IsAdmin || permission.UserHasPermission(Id, permissionCanGod))) { rust.SendChatMessage(netUser, lang.GetMessage("ChatTag", this, Id), lang.GetMessage("NoPermission", this, Id)); return; } if (args.Length == 0) { rust.SendChatMessage(netUser, lang.GetMessage("ChatTag", this, Id), lang.GetMessage("SyntaxUngod", this, Id)); return; } NetUser targetUser = rust.FindPlayer(args[0]); var name = targetUser.displayName; var steamId = targetUser.userID.ToString(); if (targetUser == null) { rust.SendChatMessage(netUser, lang.GetMessage("ChatTag", this, Id), lang.GetMessage("NoExistent", this, Id)); return; } targetUser.playerClient.rootControllable.rootCharacter.takeDamage.SetGodMode(false); { rust.SendChatMessage(netUser, lang.GetMessage("ChatTag", this, Id), string.Format(lang.GetMessage("Ungod1", this, Id), name)); rust.SendChatMessage(targetUser, lang.GetMessage("ChatTag", this, Id), string.Format(lang.GetMessage("Ungod2", this, Id), username)); return; } } }
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); } }
void cmdChat(NetUser netUser, string command, string[] args) { var Iid = netUser.userID.ToString(); var username = netUser.displayName; if (!IsHelper(netUser)) { rust.SendChatMessage(netUser, lang.GetMessage("ChatTag", this, Iid), lang.GetMessage("NoPermission", this, Iid)); return; } if (args.Length == 0) { rust.SendChatMessage(netUser, lang.GetMessage("ChatTag", this, Iid), lang.GetMessage("SyntaxChat", this, Iid)); return; } string message = string.Join(" ", args); foreach (PlayerClient player in PlayerClient.All) { var id = player.userID.ToString(); if (netUser.CanAdmin() || Profile.owner.ContainsKey(id) || Profile.admin.ContainsKey(id) || Profile.owner.ContainsKey(id) || Profile.mod.ContainsKey(id) || Profile.helper.ContainsKey(id)) { rust.SendChatMessage(netUser, "[AdminChat]", string.Format(lang.GetMessage("Chat", this, Iid), username, message)); } } }
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; }
void CheckInformations(NetUser netuser, NetUser target) { string ID = netuser.userID.ToString(); ulong netUserID = netuser.userID; if (!(netuser.CanAdmin() || permission.UserHasPermission(netUserID.ToString(), permissionVerification) || permission.UserHasPermission(netUserID.ToString(), permissionAdministration))) { rust.Notice(netuser, GetMessage("NoPermission", ID), GetMessage("FailIcon", ID)); return; } string IDt = target.userID.ToString(); string targetName = target.displayName; if (target == null || IDt == null) { rust.SendChatMessage(netuser, chatPrefix, GetMessage("InvalidPlayer", ID)); return; } var data = IDt; if (WarnsPlayers.ContainsKey(IDt)) { var informations = GetPlayerData(data); rust.SendChatMessage(netuser, chatPrefix, GetMessage("Space", ID)); rust.SendChatMessage(netuser, chatPrefix, string.Format(GetMessage("WarnInformations", ID), informations.playerName, informations.playerID, informations.playerIP, informations.playerWarns, WarnMax)); rust.SendChatMessage(netuser, chatPrefix, GetMessage("Space", ID)); } else { rust.SendChatMessage(netuser, chatPrefix, string.Format(GetMessage("WarnsInvalid", ID), targetName)); } }
void cmdPopup(NetUser netUser, string command, string[] args) { ulong netUserID = netUser.userID; if (!(netUser.CanAdmin() || permission.UserHasPermission(netUserID.ToString(), permissionCanPopupNotice))) { rust.Notice(netUser, lang.GetMessage("NoPermission", this), lang.GetMessage("FailureIcon", this)); return; } if (args.Length == 0 || args == null) { rust.Notice(netUser, lang.GetMessage("InvalidSyntax", this), lang.GetMessage("FailureIcon", this)); return; } string message = ""; foreach (string arg in args) { message = message + " " + arg; } foreach (NetUser _netUser in rust.GetAllNetUsers()) { rust.Notice(_netUser, message, lang.GetMessage("SuccessIcon", this)); } rust.Notice(netUser, lang.GetMessage("SuccessPopupNotice", this), lang.GetMessage("SuccessIcon", this)); Puts($"{netUser.displayName} {lang.GetMessage("SuccessPopupBroadcast", this)} {message}."); return; }
private void OnPlayerConnected(NetUser netUser) { // Update player's permissions group and name if (permission.IsLoaded) { var id = netUser.userID.ToString(); permission.UpdateNickname(id, netUser.displayName); var defaultGroups = Interface.Oxide.Config.Options.DefaultGroups; if (!permission.UserHasGroup(id, defaultGroups.Players)) { permission.AddUserGroup(id, defaultGroups.Players); } if (netUser.CanAdmin() && !permission.UserHasGroup(id, defaultGroups.Administrators)) { permission.AddUserGroup(id, defaultGroups.Administrators); } } // Let covalence know Covalence.PlayerManager.PlayerConnected(netUser); var iplayer = Covalence.PlayerManager.FindPlayerById(netUser.userID.ToString()); if (iplayer != null) { netUser.IPlayer = iplayer; Interface.Call("OnUserConnected", iplayer); } }
void cmdWarnPlayer(NetUser netuser, string command, string[] args) { string ID = netuser.userID.ToString(); if (!WarnSystem) { rust.SendChatMessage(netuser, chatPrefix, string.Format(GetMessage("SystemStatus", ID), GetMessage("Offline", ID))); return; } ulong netUserID = netuser.userID; if (!(netuser.CanAdmin() || permission.UserHasPermission(netUserID.ToString(), permissionWarn) || permission.UserHasPermission(netUserID.ToString(), permissionAdministration))) { rust.Notice(netuser, GetMessage("NoPermission", ID), GetMessage("FailIcon", ID)); return; } NetUser target = rust.FindPlayer(args[0]); string IDt = target.userID.ToString(); string targetName = target.displayName; if (IDt == null || targetName == null) { rust.SendChatMessage(netuser, chatPrefix, GetMessage("InvalidPlayer", ID)); return; } if (netuser == target) { rust.SendChatMessage(netuser, chatPrefix, GetMessage("WarnYou", ID)); return; } ADDWarn(netuser, target); }
///////////////////////// // Random functions ///////////////////////// bool hasPermission(NetUser netuser) { if (netuser.CanAdmin()) { return(true); } return(permission.UserHasPermission(netuser.playerClient.userID.ToString(), "cananticheat")); }
void SendHelpText(NetUser netuser) { if (!netuser.CanAdmin()) { return; } SendReply(netuser, "Sacks Remover: /sackremover NEWREMOVETIME"); }
bool hasVip(NetUser netuser, string vipname) { if (netuser.CanAdmin()) { return(true); } return(permission.UserHasPermission(netuser.playerClient.userID.ToString(), vipname)); }
bool hasAccess(NetUser netuser) { if (netuser.CanAdmin()) { return(true); } return(false); }
bool hasAccess(NetUser netuser) { if (netuser.CanAdmin()) { return(true); } return(permission.UserHasPermission(netuser.playerClient.userID.ToString(), "admin")); }
///////////////////////////////////////// // Oxide Permission system ///////////////////////////////////////// bool hasPermission(NetUser player) { if (player.CanAdmin()) { return(true); } return(permission.UserHasPermission(player.playerClient.userID.ToString(), "canjail")); }
bool hasAccess(NetUser player) { if (!player.CanAdmin()) { SendReply(player, "You are not allowed to use this command"); return(false); } return(true); }
void cmdChatSackRemover(NetUser netuser, string command, string[] args) { if (!netuser.CanAdmin()) { SendReply(netuser, "You dont have access to this command."); return; } useAutoRemover = !useAutoRemover; SaveConfig(); SendReply(netuser, "AutoSackRemover is now set to: " + useAutoRemover.ToString()); }
bool hasAccessbanipslp(NetUser netuser, string permissionname) { if (netuser.CanAdmin()) { return(true); } if (permission.UserHasPermission(netuser.playerClient.userID.ToString(), "canbanslpip")) { return(true); } return(permission.UserHasPermission(netuser.playerClient.userID.ToString(), permissionname)); }
private bool AcessAdmins(NetUser netuser) { if (netuser.CanAdmin()) { return(true); } if (permission.UserHasPermission(netuser.userID.ToString(), permissionRemoveData)) { return(true); } return(false); }
bool hasAccess(NetUser netuser, string permissionname) { if (netuser.CanAdmin()) { return(true); } if (permission.UserHasPermission(netuser.playerClient.userID.ToString(), "namefilter.allowed")) { return(true); } return(permission.UserHasPermission(netuser.playerClient.userID.ToString(), permissionname)); }
bool Acesso(NetUser netUser) { if (netUser.CanAdmin()) { return(true); } if (permission.UserHasPermission(netUser.playerClient.userID.ToString(), "adminplus")) { return(true); } return(false); }
bool AcessAdmin(NetUser netuser) { if (netuser.CanAdmin()) { return(true); } if (permission.UserHasPermission(netuser.userID.ToString(), permTransformationAdmin)) { return(true); } return(false); }
bool hasAccess(NetUser netuser, string ttype) { if (netuser.CanAdmin()) { return(true); } else if (ttype == "normal" && playerCanRemove) { return(true); } return(permission.UserHasPermission(netuser.playerClient.userID.ToString(), "canremove")); }
bool hasimmunity(NetUser netuser, string permissionname) { if (netuser.CanAdmin()) { return(true); } if (permission.UserHasPermission(netuser.playerClient.userID.ToString(), "ipbanimunity")) { return(true); } return(permission.UserHasPermission(netuser.playerClient.userID.ToString(), permissionname)); }
bool hasAccess(NetUser player) { if (!player.CanAdmin()) { SendReply(player, "You are not allowed to use this command"); return false; } return true; }
bool hasAccess(NetUser netuser) { if (netuser.CanAdmin()) return true; return permission.UserHasPermission(netuser.playerClient.userID.ToString(), "canclean"); }
bool hasAccess(NetUser netuser) { if (netuser.CanAdmin()) return true; return false; }
bool hasVip(NetUser netuser, string vipname) { if (netuser.CanAdmin()) return true; return permission.UserHasPermission(netuser.playerClient.userID.ToString(), vipname); }
private void OnPlayerConnected(NetUser netUser) { // Let covalence know covalence.PlayerManager.NotifyPlayerConnect(netUser); // Do permission stuff if (permission.IsLoaded) { var id = netUser.userID.ToString(); permission.UpdateNickname(id, netUser.displayName); // Add player to default group if (!permission.UserHasGroup(id, DefaultGroups[0])) permission.AddUserGroup(id, DefaultGroups[0]); // Add player to admin group if admin if (netUser.CanAdmin() && !permission.UserHasGroup(id, DefaultGroups[2])) permission.AddUserGroup(id, DefaultGroups[2]); } // Call covalence hook Interface.Call("OnUserConnected", covalence.PlayerManager.GetPlayer(netUser.userID.ToString())); }