public void OnBan(BanEvent ev) { ///Probably triggers when someone is banned, I can't get it to trigger though Dictionary <string, string> variables = new Dictionary <string, string> { { "allowban", ev.AllowBan.ToString() }, { "duration", (ev.Duration / 60).ToString() }, { "reason", ev.Reason }, { "result", ev.Result }, { "playeripaddress", ev.Player.IpAddress }, { "playername", ev.Player.Name }, { "playerplayerid", ev.Player.PlayerId.ToString() }, { "playersteamid", ev.Player.SteamId }, { "playerclass", ev.Player.TeamRole.Role.ToString() }, { "playerteam", ev.Player.TeamRole.Team.ToString() }, { "adminipaddress", ev.Admin.IpAddress }, { "adminname", ev.Admin.Name }, { "adminplayerid", ev.Admin.PlayerId.ToString() }, { "adminsteamid", ev.Admin.SteamId }, { "adminclass", ev.Admin.TeamRole.Role.ToString() }, { "adminteam", ev.Admin.TeamRole.Team.ToString() } }; plugin.SendMessageToBot(plugin.GetConfigString("discord_channel_onban"), "admin.onban", variables); }
public void OnBan(BanEvent ev) { if (ev.Admin != null) { Dictionary <string, string> variables = new Dictionary <string, string> { { "allowban", ev.AllowBan.ToString() }, { "duration", ev.Duration.ToString() }, { "reason", ev.Reason }, { "result", ev.Result }, { "playeripaddress", ev.Player.IpAddress }, { "playername", ev.Player.Name }, { "playerplayerid", ev.Player.PlayerId.ToString() }, { "playersteamid", ev.Player.SteamId }, { "playerclass", ev.Player.TeamRole.Role.ToString() }, { "playerteam", ev.Player.TeamRole.Team.ToString() }, { "adminipaddress", ev.Admin.IpAddress }, { "adminname", ev.Admin.Name }, { "adminplayerid", ev.Admin.PlayerId.ToString() }, { "adminsteamid", ev.Admin.SteamId }, { "adminclass", ev.Admin.TeamRole.Role.ToString() }, { "adminteam", ev.Admin.TeamRole.Team.ToString() } }; if (ev.Duration == 0) { this.plugin.SendMessage(Config.GetArray("channels.onban.admin.kick"), "admin.onban.admin.kick", variables); } else { this.plugin.SendMessage(Config.GetArray("channels.onban.admin.ban"), "admin.onban.admin.ban", variables); } } else { Dictionary <string, string> variables = new Dictionary <string, string> { { "allowban", ev.AllowBan.ToString() }, { "duration", ev.Duration.ToString() }, { "reason", ev.Reason }, { "result", ev.Result }, { "playeripaddress", ev.Player.IpAddress }, { "playername", ev.Player.Name }, { "playerplayerid", ev.Player.PlayerId.ToString() }, { "playersteamid", ev.Player.SteamId }, { "playerclass", ev.Player.TeamRole.Role.ToString() }, { "playerteam", ev.Player.TeamRole.Team.ToString() } }; if (ev.Duration == 0) { this.plugin.SendMessage(Config.GetArray("channels.onban.console.kick"), "admin.onban.console.kick", variables); } else { this.plugin.SendMessage(Config.GetArray("channels.onban.console.ban"), "admin.onban.console.ban", variables); } } }
public void OnBan(BanEvent ev) { bans_count++; if (this.isAutoBan || ev.Duration == 0) { this.isAutoBan = false; return; } bot.Post($"{ev.Player.Name} get banned", $"Time: {ev.Duration / 60} hours", ev.Player.UserId + ev.Player.IpAddress + "\tKills: " + GetKills.Find(x => x.userID == ev.Player.UserId).kills, 16732240); }
public void OnBan(BanEvent ev) { ///Doesn't seem to trigger at all, not sure why if (ev.AllowBan) { plugin.SendMessageAsync(plugin.GetConfigString("discord_channel_onban"), "Player " + ev.Player.Name + " (" + ev.Player.SteamId + plugin.MultiLanguage(52) + ev.Admin.Name + " (" + ev.Admin.SteamId + plugin.MultiLanguage(53) + (ev.Duration / 60) + plugin.MultiLanguage(54)); } else { plugin.SendMessageAsync(plugin.GetConfigString("discord_channel_onban"), ev.Admin.Name + " (" + ev.Admin.SteamId + plugin.MultiLanguage(55) + ev.Player.Name + " (" + ev.Player.SteamId + plugin.MultiLanguage(56) + (ev.Duration / 60) + plugin.MultiLanguage(57)); } }
void IEventHandlerBan.OnBan(BanEvent ev) { send(ev, new IdMapping() .appendId(Lib.ADMIN_ID, ev.Admin) .appendId(Lib.ADMIN_EVENT_SCPDATA_ID, ev.Admin.Scp079Data) .appendId(Lib.ADMIN_EVENT_TEAM_ROLE_ID, ev.Admin.TeamRole) .appendId(Lib.PLAYER_ID, ev.Player) .appendId(Lib.PLAYER_EVENT_SCPDATA_ID, ev.Player.Scp079Data) .appendId(Lib.PLAYER_EVENT_TEAM_ROLE_ID, ev.Player.TeamRole) ); }
public void OnBan(BanEvent ev) { if (ev.Player != null && ev.Player is Player) { AdminToolbox.AddMissingPlayerVariables(new List <Player> { ev.Player }); } if (AdminToolbox.playerdict.ContainsKey(ev.Player.SteamId) && ev.Duration > 1) { AdminToolbox.playerdict[ev.Player.SteamId].banCount++; } }
/* * [14:56:59] [ERROR] [Event] Event Handler: AdminHierarchyImmunity.BanHandler Failed to handle event:Smod2.Events.BanEvent * [14:56:59] [ERROR] [Event] System.NullReferenceException: Object reference not set to an instance of an object * at AdminHierarchyImmunity.BanHandler.OnBan (Smod2.Events.BanEvent ev) [0x00024] in <15c19d21366e44289781caa444765374>:0 * at Smod2.Events.BanEvent.ExecuteHandler (Smod2.EventHandlers.IEventHandler handler) [0x00000] in <30cbd5c820004c7aa2b3d48e637031c6>:0 * at Smod2.Events.EventManager.HandleEvent[T] (Smod2.Events.Event ev) [0x00016] in <30cbd5c820004c7aa2b3d48e637031c6>:0 */ public void OnBan(BanEvent ev) { if (ev.Admin == null || ev.Player == null) { return; } string[] tree = this.plugin.GetConfigList("ahi_tree"); int adminLevel = 0; int targetLevel = 0; for (int i = 0; i < tree.Length; i++) { string rank = tree[i]; //this.plugin.Info("Is the admin's rank " + (ev.Admin.GetUserGroup() != null ? ev.Admin.GetUserGroup().Name : "RN:" + ev.Admin.GetRankName()) + " equal to " + rank + "?"); if (ev.Admin.GetUserGroup() != null && ev.Admin.GetUserGroup().Name == rank) { adminLevel = tree.Length - i; } //this.plugin.Info("Is the player's rank " + (ev.Player.GetUserGroup() != null ? ev.Player.GetUserGroup().Name : "RN:" + ev.Player.GetRankName()) + " equal to " + rank + "?"); if (ev.Player.GetUserGroup() != null && ev.Player.GetUserGroup().Name == rank) { targetLevel = tree.Length - i; } } //this.plugin.Info("Is " + adminLevel + " <= " + targetLevel + "?"); if (adminLevel == 0) { this.plugin.Info("Allowing staff or global moderator " + ev.Admin.ToString() + " to ban " + ev.Player.ToString() + "."); ev.AllowBan = true; } // Do not allow moderators of the same rank to kick each other or themselves else if (adminLevel <= targetLevel) { this.plugin.Info("[STAFF VIOLATION] Admin " + ev.Admin.ToString() + " tried to ban the same or higher-ranking admin " + ev.Player.ToString()); ev.Player.PersonalBroadcast(5, ev.Player.Name + " tried to ban you. Please report this to your superior.", false); ev.Admin.PersonalBroadcast(5, "You cannot ban " + ev.Player.Name + " because he/she is the same or higher rank than you.", false); ev.AllowBan = false; } else { ev.AllowBan = true; } }
public void OnBan(BanEvent ev) { if (ev.Admin != null) { Dictionary <string, string> variables = new Dictionary <string, string> { { "allowban", ev.AllowBan.ToString() }, { "duration", (ev.Duration / 60).ToString() }, { "reason", ev.Reason }, { "result", ev.Result }, { "playeripaddress", ev.Player.IpAddress }, { "playername", ev.Player.Name }, { "playerplayerid", ev.Player.PlayerId.ToString() }, { "playersteamid", ev.Player.SteamId }, { "playerclass", ev.Player.TeamRole.Role.ToString() }, { "playerteam", ev.Player.TeamRole.Team.ToString() }, { "adminipaddress", ev.Admin.IpAddress }, { "adminname", ev.Admin.Name }, { "adminplayerid", ev.Admin.PlayerId.ToString() }, { "adminsteamid", ev.Admin.SteamId }, { "adminclass", ev.Admin.TeamRole.Role.ToString() }, { "adminteam", ev.Admin.TeamRole.Team.ToString() } }; plugin.SendMessageToBot(plugin.GetConfigString("discord_channel_onban"), "admin.onban", variables); } else { Dictionary <string, string> variables = new Dictionary <string, string> { { "allowban", ev.AllowBan.ToString() }, { "duration", ev.Duration.ToString() }, { "reason", ev.Reason }, { "result", ev.Result }, { "playeripaddress", ev.Player.IpAddress }, { "playername", ev.Player.Name }, { "playerplayerid", ev.Player.PlayerId.ToString() }, { "playersteamid", ev.Player.SteamId }, { "playerclass", ev.Player.TeamRole.Role.ToString() }, { "playerteam", ev.Player.TeamRole.Team.ToString() } }; plugin.SendMessageToBot(plugin.GetConfigString("discord_channel_onban"), "admin.onban.noadmin", variables); } }
public void OnBan(BanEvent ev) { Dictionary <string, string> variables = new Dictionary <string, string> { { "allowban", ev.AllowBan.ToString() }, { "duration", Utilities.SecondsToCompoundTime(ev.Duration) }, { "reason", ev.Reason }, { "result", ev.Result }, { "playeripaddress", ev.Player.IPAddress }, { "playername", ev.Player.Name }, { "playerplayerid", ev.Player.PlayerID.ToString() }, { "playersteamid", ev.Player.GetParsedUserID() }, { "playerclass", ev.Player.PlayerRole.RoleID.ToString() }, { "playerteam", ev.Player.PlayerRole.Team.ToString() }, { "issuer", ev.Issuer } }; if (ev.Issuer != "Server") { if (ev.Duration == 0) { this.plugin.SendMessage(Config.GetArray("channels.onban.admin.kick"), "admin.onban.admin.kick", variables); } else { this.plugin.SendMessage(Config.GetArray("channels.onban.admin.ban"), "admin.onban.admin.ban", variables); } } else { if (ev.Duration == 0) { this.plugin.SendMessage(Config.GetArray("channels.onban.console.kick"), "admin.onban.console.kick", variables); } else { this.plugin.SendMessage(Config.GetArray("channels.onban.console.ban"), "admin.onban.console.ban", variables); } } }
public void OnBan(BanEvent ev) { var args = plugin.luaHookCall.Function.Call("OnBan", ev.Player, ev.Admin, ev.Duration, ev.Reason, ev.AllowBan, ev.Result); if (args.Type == DataType.Table) { var table = args.Table; var Player = table.Get("Player"); if (Player.IsNotNil()) { ev.Player = Player.ToObject <Player>(); } var Admin = table.Get("Admin"); if (Admin.IsNotNil()) { ev.Admin = Admin.ToObject <Player>(); } var Duration = table.Get("Duration"); if (Duration.IsNotNil()) { ev.Duration = (int)Duration.Number; } var Reason = table.Get("Reason"); if (Reason.IsNotNil()) { ev.Reason = Reason.String; } var AllowBan = table.Get("AllowBan"); if (AllowBan.IsNotNil()) { ev.AllowBan = AllowBan.Boolean; } var Result = table.Get("Result"); if (Result.IsNotNil()) { ev.Result = Result.String; } } }
public void OnBanEvent(BanEvent be) { this.Invoke("On_PlayerBan", new object[] { be }); }
public void OnBanEvent(BanEvent be) { Invoke("On_PlayerBan", be); }
public void OnBan(BanEvent ev) { SendBan(ev.Issuer.Nick, ev.Player.Nick, ev.Player.ParsedUserId, ev.Reason, ev.Issuance, ev.Expiration); }