-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from terminator-97/master
2.5.0
- Loading branch information
Showing
12 changed files
with
301 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using System; | ||
using System.Text; | ||
using CommandSystem; | ||
using Exiled.Permissions.Extensions; | ||
|
||
namespace SCPUtils.Commands | ||
{ | ||
[CommandHandler(typeof(RemoteAdminCommandHandler))] | ||
[CommandHandler(typeof(GameConsoleCommandHandler))] | ||
[CommandHandler(typeof(ClientCommandHandler))] | ||
class OnlineList : ICommand | ||
{ | ||
public string Command { get; } = "scputils_online_list"; | ||
|
||
public string[] Aliases { get; } = new[] { "ol", "onlinelist" }; | ||
|
||
public string Description { get; } = "Show online player list"; | ||
|
||
|
||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
if (!sender.CheckPermission("scputils.onlinelist.basic")) | ||
{ | ||
response = "You need a higher administration level to use this command!"; | ||
return false; | ||
} | ||
StringBuilder message = new StringBuilder($"Online Players ({CountOnlineMembers()})"); | ||
|
||
foreach (var player in Exiled.API.Features.Player.List) | ||
{ | ||
message.AppendLine(); | ||
message.Append($"({player.Id}) {player.Nickname}"); | ||
if (sender.CheckPermission("scputils.onlinelist.userid")) message.Append($" ({player.UserId})"); | ||
if (sender.CheckPermission("scputils.onlinelist.badge") && player.Group.BadgeText!=null) message.Append($" [{player.Group.BadgeText}]"); | ||
if (sender.CheckPermission("scputils.onlinelist.role")) message.Append($" [{player.Role}]"); | ||
if (sender.CheckPermission("scputils.onlinelist.health")) message.Append($" HP {player.Health} / {player.MaxHealth}"); | ||
if (sender.CheckPermission("scputils.onlinelist.flags")) | ||
{ | ||
if (player.IsOverwatchEnabled) message.Append(" [OVERWATCH]"); | ||
if (player.NoClipEnabled) message.Append(" [NOCLIP]"); | ||
if (player.IsGodModeEnabled) message.Append(" [GODMODE]"); | ||
if (player.IsStaffBypassEnabled) message.Append(" [BYPASS MODE]"); | ||
if (player.IsIntercomMuted) message.Append(" [INTERCOM MUTED]"); | ||
if (player.IsMuted) message.Append(" [SERVER MUTED]"); | ||
if (player.DoNotTrack) message.Append(" [DO NOT TRACK]"); | ||
if (player.RemoteAdminAccess) message.Append(" [RA]"); | ||
} | ||
} | ||
if (CountOnlineMembers() == 0) | ||
{ | ||
response = "No player online!"; | ||
return true; | ||
} | ||
response = $"{message}"; | ||
return true; | ||
} | ||
|
||
private static int CountOnlineMembers() | ||
{ | ||
var value = 0; | ||
foreach (var player in Exiled.API.Features.Player.List) | ||
{ | ||
value++; | ||
} | ||
return value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
using System; | ||
using System.Text; | ||
using CommandSystem; | ||
using Exiled.Permissions.Extensions; | ||
|
||
namespace SCPUtils.Commands | ||
{ | ||
[CommandHandler(typeof(RemoteAdminCommandHandler))] | ||
[CommandHandler(typeof(GameConsoleCommandHandler))] | ||
[CommandHandler(typeof(ClientCommandHandler))] | ||
class RoundInfo : ICommand | ||
{ | ||
public string Command { get; } = "scputils_round_info"; | ||
|
||
public string[] Aliases { get; } = new[] { "ri", "roundinfo", "round_info" }; | ||
public string Description { get; } = "Show round info"; | ||
|
||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
var player = Exiled.API.Features.Player.Get(Exiled.API.Features.Player.Get(((CommandSender)sender).SenderId).ToString().Split(new string[] { " " }, StringSplitOptions.None)[2]); | ||
if (!sender.CheckPermission("scputils.roundinfo.execute") && !ScpUtils.StaticInstance.Config.AllowedMtfInfoTeam.Contains(player.Team) && !ScpUtils.StaticInstance.Config.AllowedChaosInfoTeam.Contains(player.Team)) | ||
{ | ||
response = "You need a higher administration level to use this command!"; | ||
return false; | ||
} | ||
|
||
if (!Exiled.API.Features.Round.IsStarted) | ||
{ | ||
response = "Round is not started yet!"; | ||
return true; | ||
} | ||
else | ||
{ | ||
StringBuilder message = new StringBuilder($"Round Info:"); | ||
if (sender.CheckPermission("scputils.roundinfo.roundtime")) | ||
{ | ||
message.AppendLine($"Round time: {Exiled.API.Features.Round.ElapsedTime.ToString(@"hh\:mm\:ss")}"); | ||
} | ||
if (sender.CheckPermission("scputils.roundinfo.tickets") || ScpUtils.StaticInstance.Config.AllowedChaosInfoTeam.Contains(player.Team)) | ||
{ | ||
message.AppendLine($"Number of Chaos Tickets: {Exiled.API.Features.Respawn.ChaosTickets}"); | ||
} | ||
if (sender.CheckPermission("scputils.roundinfo.tickets") || ScpUtils.StaticInstance.Config.AllowedMtfInfoTeam.Contains(player.Team)) | ||
{ | ||
message.AppendLine($"Number of MTF Tickets: {Exiled.API.Features.Respawn.NtfTickets}"); | ||
} | ||
|
||
if (sender.CheckPermission("scputils.roundinfo.nextrespawnteam") || ScpUtils.StaticInstance.Config.AllowedChaosInfoTeam.Contains(player.Team) || ScpUtils.StaticInstance.Config.AllowedMtfInfoTeam.Contains(player.Team)) | ||
{ | ||
message.AppendLine($"Next known Respawn Team: {Exiled.API.Features.Respawn.NextKnownTeam}"); | ||
message.AppendLine($"Time until respawn: {TimeSpan.FromSeconds(Exiled.API.Features.Respawn.TimeUntilRespawn).ToString(@"hh\:mm\:ss")}"); | ||
} | ||
|
||
if (sender.CheckPermission("scputils.roundinfo.respawncount") || ScpUtils.StaticInstance.Config.AllowedChaosInfoTeam.Contains(player.Team)) | ||
{ | ||
message.AppendLine($"Number of Chaos Respawn Waves: {ScpUtils.StaticInstance.EventHandlers.ChaosRespawnCount}"); | ||
} | ||
if (sender.CheckPermission("scputils.roundinfo.respawncount") || ScpUtils.StaticInstance.Config.AllowedMtfInfoTeam.Contains(player.Team)) | ||
{ | ||
message.AppendLine($"Number of Mtf Respawn Waves: {ScpUtils.StaticInstance.EventHandlers.MtfRespawnCount}"); | ||
} | ||
if (sender.CheckPermission("scputils.roundinfo.lastrespawn") || ScpUtils.StaticInstance.Config.AllowedChaosInfoTeam.Contains(player.Team)) | ||
{ | ||
if (ScpUtils.StaticInstance.EventHandlers.ChaosRespawnCount >= 1) | ||
{ | ||
var timespan = (DateTime.Now - ScpUtils.StaticInstance.EventHandlers.LastChaosRespawn); | ||
message.AppendLine($"Last Chaos wave respawn elapsed time: { timespan.ToString(@"hh\:mm\:ss")} ").AppendLine(); | ||
|
||
} | ||
} | ||
if (sender.CheckPermission("scputils.roundinfo.lastrespawn") || ScpUtils.StaticInstance.Config.AllowedMtfInfoTeam.Contains(player.Team)) | ||
{ | ||
if (ScpUtils.StaticInstance.EventHandlers.MtfRespawnCount >= 1) | ||
{ | ||
var timespan = (DateTime.Now - ScpUtils.StaticInstance.EventHandlers.LastMtfRespawn); | ||
|
||
message.AppendLine($"Last MTF wave respawn elapsed time: { timespan.ToString(@"hh\:mm\:ss")}"); | ||
} | ||
} | ||
response = $"{message}"; | ||
|
||
} | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.