public void OnRoundEnd(RoundEndEvent ev) { if (ev.Round.Duration >= 3) { AdminToolbox.isRoundFinished = true; AdminToolbox.lockRound = false; if (ConfigManager.Manager.Config.GetBoolValue("admintoolbox_round_info", true, false)) { plugin.Info("Round: " + AdminToolbox.roundCount + " has ended."); int minutes = (int)(ev.Round.Duration / 60), duration = ev.Round.Duration; if (duration < 60) { plugin.Info("Round lasted for: " + duration + " sec"); } else { plugin.Info("Round lasted for: " + minutes + " min, " + (duration - (minutes * 60)) + " sec"); } } if (AdminToolbox.warpVectors.Count > 0) { AdminToolbox.warpVectors.Clear(); } } foreach (Player pl in PluginManager.Manager.Server.GetPlayers()) { AdminToolbox.AddSpesificPlayer(pl); if (AdminToolbox.playerStats.ContainsKey(pl.SteamId)) { AdminToolbox.playerStats[pl.SteamId][3]++; } } }
public void OnPlayerJoin(PlayerJoinEvent ev) { AdminToolbox.AddSpesificPlayer(ev.Player); if (ConfigManager.Manager.Config.GetBoolValue("admintoolbox_debug_player_joinANDleave", false, false)) { plugin.Info(ev.Player.Name + " just joined the server!"); } //AdminToolbox.godMode[player.SteamId][0] = false; }
public void OnSpawn(PlayerSpawnEvent ev) { AdminToolbox.AddSpesificPlayer(ev.Player); if (AdminToolbox.playerDeathPos.ContainsKey(ev.Player.SteamId)) { AdminToolbox.playerDeathPos[ev.Player.SteamId] = ev.SpawnPos; } if (AdminToolbox.playerdict[ev.Player.SteamId][0]) { ev.Player.ChangeRole(Role.SPECTATOR); } }
public void OnIntercom(PlayerIntercomEvent ev) { AdminToolbox.AddSpesificPlayer(ev.Player); defaultIntercomDuration = ev.SpeechTime; defaultIntercomCooldown = ev.CooldownTime; //string[] whitelistRanks = ConfigManager.Manager.Config.GetListValue("admintoolbox_intercom_whitelist"); //if (whitelistRanks.Length > 0) //{ // foreach (var item in whitelistRanks) // { // string[] myKeyString = item.Split(':'); // if (myKeyString[0] == ev.Player.GetRankName()) // { // if (myKeyString.Length == 2) // { // string[] myString = myKeyString[1].Split('.', '-', '#', '_', ' '); // if (myString.Length >= 1) // { // if (Int32.TryParse(myString[0], out int x)) // ev.SpeechTime = x; // if (myString.Length == 2) // if (Int32.TryParse(myString[1], out int z)) // ev.CooldownTime = z; // if (myString.Length > 2) // plugin.Error("Unknown values at \"admintoolbox_intercom_whitelist: " + ev.Player.GetRankName() + ":" + myKeyString[1] + "\", skipping..."); // } // } // else // plugin.Info("Value for: \"" + ev.Player.GetRankName() + "\" not found"); // } // } //} //Blacklist string[] blackListedSTEAMIDS = ConfigManager.Manager.Config.GetListValue("admintoolbox_intercom_steamid_blacklist", new string[] { string.Empty }, false); if (blackListedSTEAMIDS.Length > 0) { foreach (string item in blackListedSTEAMIDS) { if (item == ev.Player.SteamId) { ev.SpeechTime = 0; break; } } } }
public void OnDoorAccess(PlayerDoorAccessEvent ev) { AdminToolbox.AddSpesificPlayer(ev.Player); if (AdminToolbox.playerdict.ContainsKey(ev.Player.SteamId)) { if (AdminToolbox.playerdict[ev.Player.SteamId][3]) { ev.Destroy = true; } if (AdminToolbox.playerdict[ev.Player.SteamId][5]) { ev.Allow = false; } } }
public void OnPlayerHurt(PlayerHurtEvent ev) { int[] humanDamageTypes = { (int)DamageType.COM15, (int)DamageType.E11_STANDARD_RIFLE, (int)DamageType.P90, (int)DamageType.MP7, (int)DamageType.LOGICER, (int)DamageType.FRAG }, scpDamagesTypes = { (int)DamageType.SCP_049, (int)DamageType.SCP_049_2, (int)DamageType.SCP_096, (int)DamageType.SCP_106, (int)DamageType.SCP_173, (int)DamageType.SCP_939 }, nineTailsTeam = { (int)Team.MTF, (int)Team.RSC }, chaosTeam = { (int)Team.CHI, (int)Team.CDP }; AdminToolbox.AddSpesificPlayer(ev.Player); AdminToolbox.AddSpesificPlayer(ev.Attacker); float originalDamage = ev.Damage; DamageType originalType = ev.DamageType; if (AdminToolbox.playerdict.ContainsKey(ev.Player.SteamId)) { if (AdminToolbox.playerdict[ev.Player.SteamId][1]) { ev.Damage = 0f; ev.DamageType = DamageType.NONE;; return; } ; } if (AdminToolbox.playerdict.ContainsKey(ev.Attacker.SteamId)) { if (AdminToolbox.playerdict[ev.Attacker.SteamId][2]) { ev.Damage = 0f; ev.DamageType = DamageType.NONE;; return; } ; } int[] allowedDmg = ConfigManager.Manager.Config.GetIntListValue("admintoolbox_tutorial_dmg_allowed", new int[] { -1 }, false); int[] DebugDmg = ConfigManager.Manager.Config.GetIntListValue("admintoolbox_debug_damagetypes", humanDamageTypes, false); float damageMultiplier = ConfigManager.Manager.Config.GetFloatValue("admintoolbox_round_damageMultiplier", 1, true); ev.Damage = ev.Damage * damageMultiplier; if (AdminToolbox.playerdict.ContainsKey(ev.Player.SteamId)) { if (AdminToolbox.playerdict[ev.Attacker.SteamId][6]) { if (ev.DamageType != DamageType.FRAG) { ev.Damage = ev.Player.GetHealth() + 1; } } } string[] roleDamages = ConfigManager.Manager.Config.GetListValue("admintoolbox_block_role_damage", new string[] { "14:14" }, false); if (roleDamages.Length > 0) { bool foundPlayer = false; foreach (var item in roleDamages) { string[] myStringKey = item.Replace(" ", "").Split(':'); if (!Int32.TryParse(myStringKey[0], out int z)) { plugin.Info("Not a valid config at \"admintoolbox_block_role_damage\" Value: " + myStringKey[0] + ":" + myStringKey[1]); continue; } string[] myString = myStringKey[1].Split('.', '-', '#', '_', ',', '+', '@', '>', '<', ';'); if (myString.Length >= 1) { foreach (var item2 in myString) { if (Int32.TryParse(item2, out int x)) { if (z == (int)ev.Attacker.TeamRole.Role && x == (int)ev.Player.TeamRole.Role) { ev.Damage = 0f; ev.DamageType = DamageType.NONE; foundPlayer = true; break; } } else { plugin.Info("Invalid config value at \"admintoolbox_block_role_damage:\" Value: " + myStringKey[0] + ":" + myStringKey[1] + "\nSkipping entry..."); continue; } } if (foundPlayer) { break; } } } if (foundPlayer) { return; } } if (AdminToolbox.isRoundFinished) { float enddamageMultiplier = ConfigManager.Manager.Config.GetFloatValue("admintoolbox_endedRound_damageMultiplier", 1, true); ev.Damage = originalDamage * enddamageMultiplier; if ((int)ev.Player.TeamRole.Role != 14) { return; } } switch ((int)ev.Player.TeamRole.Role) { case 14: if (!allowedDmg.Contains((int)ev.DamageType)) { if (DebugDmg.Contains((int)ev.DamageType) && (ConfigManager.Manager.Config.GetBoolValue("admintoolbox_debug_tutorial", false, false))) { plugin.Info(ev.Player.TeamRole.Name + " " + ev.Player.Name + " not allowed damagetype: " + ev.DamageType); } ev.DamageType = DamageType.NONE; ev.Damage = 0f; return; } else { goto default; } default: if (ev.Player.TeamRole.Role == Role.SCP_106) { LastAttacked.last106Damage = ev.DamageType; } ; if ((ev.Attacker.Name == "Server" && !(ConfigManager.Manager.Config.GetBoolValue("admintoolbox_debug_server", false, false))) || (ev.Attacker.Name == "Spectator" && !(ConfigManager.Manager.Config.GetBoolValue("admintoolbox_debug_spectator", false, false)))) { return; } if (nineTailsTeam.Contains((int)ev.Player.TeamRole.Team) && nineTailsTeam.Contains((int)ev.Attacker.TeamRole.Team)) { if (ev.DamageType == DamageType.FRAG) { LastAttacked.lastAttacker = ev.Attacker; LastAttacked.lastVictim = ev.Player; LastAttacked.lastDamageType = ev.DamageType; //string x = LastAttacked.lastAttacker.Name + " " + LastAttacked.lastVictim.Name + " " + LastAttacked.lastDamageType; //plugin.Info(x); } if (ConfigManager.Manager.Config.GetBoolValue("admintoolbox_debug_friendly_damage", false, false)) { if (DebugDmg.Contains((int)ev.DamageType)) { plugin.Info(ev.Attacker.TeamRole.Name + " " + ev.Attacker.Name + " attacked fellow " + ev.Player.TeamRole.Name + " " + ev.Player.Name + /*" for " + damage +^*/ " with " + ev.DamageType); } } } else if (chaosTeam.Contains((int)ev.Player.TeamRole.Team) && chaosTeam.Contains((int)ev.Attacker.TeamRole.Team)) { if (ev.DamageType == DamageType.FRAG) { LastAttacked.lastAttacker = ev.Attacker; LastAttacked.lastVictim = ev.Player; LastAttacked.lastDamageType = ev.DamageType; } if (ConfigManager.Manager.Config.GetBoolValue("admintoolbox_debug_friendly_damage", false, false)) { if (DebugDmg.Contains((int)ev.DamageType)) { plugin.Info(ev.Attacker.TeamRole.Name + " " + ev.Attacker.Name + " attacked fellow " + ev.Player.TeamRole.Name + " " + ev.Player.Name + /*" for " + damage +^*/ " with " + ev.DamageType); } } } else if (ConfigManager.Manager.Config.GetBoolValue("admintoolbox_debug_player_damage", false, false)) { if (DebugDmg.Contains((int)ev.DamageType)) { plugin.Info(ev.Attacker.TeamRole.Name + " " + ev.Attacker.Name + " attacked " + ev.Player.TeamRole.Name + " " + ev.Player.Name + /*" for " + ev.Damage + " damage" +*/ " with: " + ev.DamageType); } } break; } }
public void OnPlayerDie(PlayerDeathEvent ev) { int[] nineTailsTeam = { (int)Team.MTF, (int)Team.RSC }, chaosTeam = { (int)Team.CHI, (int)Team.CDP }; AdminToolbox.AddSpesificPlayer(ev.Player); AdminToolbox.AddSpesificPlayer(ev.Killer); if (AdminToolbox.playerDeathPos.ContainsKey(ev.Player.SteamId)) { AdminToolbox.playerDeathPos[ev.Player.SteamId] = ev.Player.GetPosition(); } if (ev.Player.Name == "Server" || ev.Killer.Name == "Server") { ev.SpawnRagdoll = false; return; } if (AdminToolbox.playerStats.ContainsKey(ev.Player.SteamId)) { AdminToolbox.playerStats[ev.Player.SteamId][2]++; } switch ((int)ev.Player.TeamRole.Role) { case 3: if (LastAttacked.last106Damage == DamageType.LURE || LastAttacked.last106Damage == DamageType.CONTAIN) { ev.SpawnRagdoll = false; } goto default; default: if (AdminToolbox.isRoundFinished) { return; } if (!(ConfigManager.Manager.Config.GetBoolValue("admintoolbox_debug_scp_and_self_killed", false, false)) && ev.Player.Name == ev.Killer.Name) { return; } if (nineTailsTeam.Contains((int)ev.Player.TeamRole.Team) && nineTailsTeam.Contains((int)ev.Killer.TeamRole.Team)) { if (AdminToolbox.playerStats.ContainsKey(ev.Killer.SteamId)) { AdminToolbox.playerStats[ev.Killer.SteamId][1]++; } if (ConfigManager.Manager.Config.GetBoolValue("admintoolbox_debug_friendly_kill", true, false)) { if ((LastAttacked.lastDamageType == DamageType.FRAG) && (ev.Player.SteamId == LastAttacked.lastVictim.SteamId && ev.Killer.SteamId == LastAttacked.lastAttacker.SteamId)) { if (AdminToolbox.isColored) { plugin.Info(ev.Killer.TeamRole.Name + " @#fg=Yellow;" + ev.Killer.Name + "@#fg=Red; granaded @#fg=Default;fellow @#fg=Blue;" + ev.Player.TeamRole.Name + "@#fg=Yellow; " + ev.Player.Name + "@#fg=Default;"); } else { plugin.Info(ev.Killer.TeamRole.Name + " " + ev.Killer.Name + " granaded fellow " + ev.Player.TeamRole.Name + " " + ev.Player.Name); } AdminToolbox.WriteToLog(new string[] { ev.Killer.TeamRole.Name + " " + ev.Killer.Name + " granaded fellow " + ev.Player.TeamRole.Name + " " + ev.Player.Name }, LogHandlers.ServerLogType.TeamKill); LastAttacked.lastAttacker = null; LastAttacked.lastVictim = null; LastAttacked.lastDamageType = DamageType.NONE; } else { if (AdminToolbox.isColored) { plugin.Info(ev.Killer.TeamRole.Name + " @#fg=Yellow;" + ev.Killer.Name + "@#fg=Red; killed fellow @#fg=Blue;" + ev.Player.TeamRole.Name + " @#fg=Yellow;" + ev.Player.Name + "@#fg=Default;"); } else { plugin.Info(ev.Killer.TeamRole.Name + " " + ev.Killer.Name + " killed fellow " + ev.Player.TeamRole.Name + " " + ev.Player.Name); } AdminToolbox.WriteToLog(new string[] { ev.Killer.TeamRole.Name + " " + ev.Killer.Name + " killed fellow " + ev.Player.TeamRole.Name + " " + ev.Player.Name }, LogHandlers.ServerLogType.TeamKill); } } } else if (chaosTeam.Contains((int)ev.Player.TeamRole.Team) && chaosTeam.Contains((int)ev.Killer.TeamRole.Team)) { if (AdminToolbox.playerStats.ContainsKey(ev.Killer.SteamId)) { AdminToolbox.playerStats[ev.Killer.SteamId][1]++; } if (ConfigManager.Manager.Config.GetBoolValue("admintoolbox_debug_friendly_kill", true, false)) { if ((LastAttacked.lastDamageType == DamageType.FRAG) && (ev.Player.SteamId == LastAttacked.lastVictim.SteamId && ev.Killer.SteamId == LastAttacked.lastAttacker.SteamId)) { if (AdminToolbox.isColored) { plugin.Info(ev.Killer.TeamRole.Name + " @#fg=Yellow;" + ev.Killer.Name + "@#fg=Red; granaded @#fg=Default;fellow @#fg=Green;" + ev.Player.TeamRole.Name + " @#fg=Yellow;" + ev.Player.Name + "@#fg=Default;"); } else { plugin.Info(ev.Killer.TeamRole.Name + " " + ev.Killer.Name + " granaded fellow " + ev.Player.TeamRole.Name + " " + ev.Player.Name); } AdminToolbox.WriteToLog(new string[] { ev.Killer.TeamRole.Name + " " + ev.Killer.Name + " granaded fellow " + ev.Player.TeamRole.Name + " " + ev.Player.Name }, LogHandlers.ServerLogType.TeamKill); LastAttacked.lastAttacker = null; LastAttacked.lastVictim = null; LastAttacked.lastDamageType = DamageType.NONE; } else { if (AdminToolbox.isColored) { plugin.Info(ev.Killer.TeamRole.Name + " @#fg=Yellow;" + ev.Killer.Name + "@#fg=Red; killed fellow @#fg=Green;" + ev.Player.TeamRole.Name + " @#fg=Yellow;" + ev.Player.Name + "@#fg=Default;"); } else { plugin.Info(ev.Killer.TeamRole.Name + " " + ev.Killer.Name + " killed fellow " + ev.Player.TeamRole.Name + " " + ev.Player.Name); } AdminToolbox.WriteToLog(new string[] { ev.Killer.TeamRole.Name + " " + ev.Killer.Name + " killed fellow " + ev.Player.TeamRole.Name + " " + ev.Player.Name }, LogHandlers.ServerLogType.TeamKill); } } } else if ((ConfigManager.Manager.Config.GetBoolValue("admintoolbox_debug_player_kill", false, false))) { plugin.Info(ev.Killer.Name + " killed: " + ev.Player.Name); if (AdminToolbox.playerStats.ContainsKey(ev.Killer.SteamId)) { AdminToolbox.playerStats[ev.Killer.SteamId][0]++; } AdminToolbox.WriteToLog(new string[] { ev.Killer.TeamRole.Name + " " + ev.Killer.Name + " killed " + ev.Player.TeamRole.Name + " " + ev.Player.Name }, LogHandlers.ServerLogType.KillLog); } else if (AdminToolbox.playerStats.ContainsKey(ev.Killer.SteamId)) { AdminToolbox.playerStats[ev.Killer.SteamId][0]++; } break; } }