void cmdBanID(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; } if (rust.FindPlayer(targetUserIDString) == null) { rust.RunServerCommand($"banid {targetUserIDString} \"OfflinePlayer\" \"Reason\""); rust.Notice(netUser, $"{lang.GetMessage("SuccessBannedNotice", this)} {targetUserIDString}.", lang.GetMessage("SuccessIcon", this)); rust.BroadcastChat(lang.GetMessage("ChatPrefix", this), $"{targetUserIDString} {lang.GetMessage("SuccessBannedBroadcast", this)}"); Puts($"{targetUserIDString} {lang.GetMessage("SuccessBannedBroadcast", this)}"); return; } NetUser targetUser = rust.FindPlayer(targetUserIDString); targetUser.Ban(); targetUser.Kick(NetError.Facepunch_Kick_Ban, true); rust.Notice(netUser, $"{lang.GetMessage("SuccessBannedNotice", this)} {targetUser.displayName}.", lang.GetMessage("SuccessIcon", this)); rust.BroadcastChat(lang.GetMessage("ChatPrefix", this), $"{targetUser.displayName} {lang.GetMessage("SuccessBannedBroadcast", this)}"); Puts($"{targetUser.displayName} {lang.GetMessage("SuccessBannedBroadcast", this)}"); return; }
void CheckWarns(NetUser netuser) { string ID = netuser.userID.ToString(); var PlayerW = GetPlayerData(ID); if (PlayerW.playerWarns == WarnMax) { rust.BroadcastChat(chatPrefix, string.Format(GetMessage("WarnPunition"), netuser.displayName)); timer.Once(0.1f, () => { netuser.Ban(); netuser.Kick(NetError.Facepunch_Kick_Ban, true); }); SaveData(); } }
void cmdBan(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; } NetUser targetUser = rust.FindPlayer(args[0]); if (targetUser == null) { rust.Notice(netUser, lang.GetMessage("NoPlayersFound", this), lang.GetMessage("FailureIcon", this)); return; } rust.RunClientCommand(targetUser, $"deathscreen.reason \"{lang.GetMessage("DeathscreenBanned", this)}\""); rust.RunClientCommand(targetUser, "deathscreen.show"); targetUser.Ban(); targetUser.Kick(NetError.Facepunch_Kick_Ban, true); rust.Notice(netUser, $"{lang.GetMessage("SuccessBannedNotice", this)} {targetUser.displayName}.", lang.GetMessage("SuccessIcon", this)); rust.BroadcastChat(lang.GetMessage("ChatPrefix", this), $"{targetUser.displayName} {lang.GetMessage("SuccessBannedBroadcast", this)}"); Puts($"{targetUser.displayName} {lang.GetMessage("SuccessBannedBroadcast", this)}"); return; }
public static void BanUser(NetUser player) { player.Ban(); //player.playerClient.netUser.Ban(); }