-
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.
- Loading branch information
1 parent
f58070a
commit 6a9c4b5
Showing
25 changed files
with
333 additions
and
124 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
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
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
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,61 @@ | ||
using CommandSystem; | ||
using Exiled.Permissions.Extensions; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace SCPUtils.Commands | ||
{ | ||
[CommandHandler(typeof(RemoteAdminCommandHandler))] | ||
[CommandHandler(typeof(GameConsoleCommandHandler))] | ||
internal class SetRoundBan : ICommand | ||
{ | ||
public string Command { get; } = "scputils_set_round_ban"; | ||
|
||
public string[] Aliases { get; } = new[] { "srb", "roundban", "su_srb", "su_roundban" }; | ||
|
||
public string Description { get; } = "Sets the number of round ban to one player"; | ||
|
||
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response) | ||
{ | ||
string target; | ||
|
||
if (!sender.CheckPermission("scputils.roundban")) | ||
{ | ||
response = "<color=red> You need a higher administration level to use this command!</color>"; | ||
return false; | ||
|
||
|
||
} | ||
|
||
if (arguments.Count < 2) | ||
{ | ||
response = $"<color=yellow>Usage: {Command} <player name/id> <Round bans to set> </color>"; | ||
return false; | ||
} | ||
else target = arguments.Array[1].ToString(); | ||
|
||
|
||
Player databasePlayer = target.GetDatabasePlayer(); | ||
|
||
if (databasePlayer == null) | ||
{ | ||
response = "Player not found on Database or Player is loading data!"; | ||
return false; | ||
} | ||
|
||
if (int.TryParse(arguments.Array[2].ToString(), out int rounds)) | ||
{ | ||
databasePlayer.RoundBanLeft = rounds; | ||
Database.LiteDatabase.GetCollection<Player>().Update(databasePlayer); | ||
response = "Success!"; | ||
return true; | ||
} | ||
|
||
else | ||
{ | ||
response = "Number of rounds must be an integer!"; | ||
return false; | ||
} | ||
} | ||
} | ||
} |
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
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.