Skip to content

Commit

Permalink
Merge pull request #8 from terminator-97/master
Browse files Browse the repository at this point in the history
2.4.4
  • Loading branch information
terminator-97 authored Jan 31, 2021
2 parents 00e41cf + 7d3de2a commit facd934
Show file tree
Hide file tree
Showing 42 changed files with 1,985 additions and 894 deletions.
64 changes: 57 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@


**SCPUtils Plugin**<br />

Welcome to SCPUtils, overtime i implemented many features so i decided to rework the documentation.
Expand All @@ -17,21 +18,24 @@ This is the list of SCPUtils features with a brief description, i recomend to re
- **SCPSpeak features:** Playing with permissions you can decide which badge (even default one) can speak with that SCP like 939 using V!
- **Playtime statistics:** You can see each user playtime day per day or total playtime using a simple command!
- **ASNs Bans:** You can ban specific ASNs to avoid ban evaders and cheaters, you can whitelist legit users to bypass the ASNs bans using a simple command, to add an ASN to blacklist add it inside server config setting.
- **Team protection:** Editing configs you can set protection to the teams you want against the teams you want on specific zones or entire map.


**Database will get created inside Exiled/SCPUtils folder.**<br /><br />
**Each server must have it's own database, you cannot use one database on multiple servers!**<br /><br />
**You must add LiteDB.dll into Plugins/dependencies folder or plugin won't work**<br /><br />
**Required minimum Exiled version: 2.0.0**
**Currently plugin is in beta phase, documentation is not complete**
**Minimum requirements: Exiled version: 2.1.29 and LiteDB 5.0.9**


### Configs:

You can see settings and edit them inside Exiled/port-config.yml file(example Exiled/7777-config.yml)

**Admin commands**
**Admin commands and Game console commands**

| Admin Commands | Args | Permission | Description |
| ------------- | ------------- | ------------- | ------------- |
| scputils_help | none | none | Show plugin info |
| scputils_help | none | scputils.help | Show plugin info |
| scputils_player_info | player / id / userid | scputils.playerinfo | Show player info |
| scputils_player_list | minimun percentage | scputils.playerlist | List all players with a percetage equal or higher of quits/suicides |
| scputils_player_reset | player / id / userid | scputils.playerreset | Reset warns,suicides,bans,kick and games played stats |
Expand All @@ -43,6 +47,17 @@ You can see settings and edit them inside Exiled/port-config.yml file(example Ex
| scputils_play_time | <player / id / userid> <range days> | scputils.playtime | Show recent player activity withing the specified days |
| scputils_whitelist_asn | <id / userid> | scputils.whitelist | Add player to ASN whitelist |
| scputils_unwhitelist_asn | <id / userid> | scputils.whitelist | Removes player to ASN whitelist |
| scputils_staff_list | - | scputils.stafflist | Show both local staff and global staff present in game |
| scputils_enable_suicide_warns | - | scputils.warnmanagement | Enabled previously disabled suicide / quits warns |
| scputils_disable_suicide_warns | - | scputils.warnmanagement | Disable suicides / quits warns for the rest of the round |
| scputils_global_edit | <Total SCP Games to remove> <Suicides/Quits to remove> <Kicks to remove> <Bans to remove> | scputils.globaledit | Globally edits player stats (removes total scp games/suicides/kicks/bans) |
| scputils_player_edit | <id / userid> <Total SCP Games> <Suicides/Quits> <Kicks> <Bans>| scputils.playeredit | Edits player stats (total scp games/suicides/kicks/bans) by setting them to specified amount |
| scputils_player_delete | <userid / id> | scputils.playerdelete | Deletes a player from db, action is irreversible, do this when player is not in server. |
| scputils_preference_persist | <userid / id> | scputils.keep | If disabled by config players that lose the permission to change name,color,hide badge will have that setting resetted, by using this command you allow the player to use their preference even without permissions |
| scputils_player_restrict | <userid / id> | scputils.moderatecommands | <duration in minutes (0=permanent) <reason> | You can a specific player from change name and color feature |
| scputils_player_unrestrict | <userid / id> | scputils.moderatecommands | Unban a previously command banned player |
| scputils_show_command_bans | <userid / id> | scputils.moderatecommands | Show command ban history of a specific player |
| scputils_remove_previous_badge | <userid / id> | scputils.handlebadges | Removes previous badge from database for that player |

**Console commands**

Expand All @@ -55,6 +70,7 @@ You can see settings and edit them inside Exiled/port-config.yml file(example Ex
| scputils_show_badge | none | scputils.badgevisibility | Permanently show your badge |
| scputils_hide_badge | none | scputils.badgevisibility | Permanently hide your badge |
| scputils_my_info | none | none | Show your preferences and temporarily badges info |
| scputils_play_time | none | scputils.ownplaytime | Show your own playtime with a max range of 120 days |

**Speak permissions**

Expand All @@ -73,6 +89,7 @@ You can see settings and edit them inside Exiled/port-config.yml file(example Ex
| Permisssion | Description |
| ------------- | ------------- |
| scputils.bypassnickrestriction | Allows to bypass nickname restrictions |
| scputils.help | Show also admin command list in scputils_help command, without this permission only user commands are shown |

Pro tip: use scputils_speak.* to allow someone to speak with all the SCPs, set permission to default role to allow everyone to speak with that scp.

Expand All @@ -86,15 +103,17 @@ To edit your configs you must go into EXILED folder and edit port-config.yml fil
<br />To edit permissions you must go into Plugins/Exiled Permissions folder and edit permissions.yml file, bellow you can see a sample config<br />

```
groups:
user:
inheritance: []
default: true
permissions:
- scputils_speak.scp049
owner:
permissions:
- '*'
- scputils.*
- scputils_speak.*
admin:
inheritance: []
permissions:
- scputils.playerinfo
- scputils.playerlist
Expand All @@ -104,12 +123,43 @@ groups:
- scputils.playerresetpreferences
- scputils_speak.*
vip:
inheritance: []
permissions:
- scputils.changecolor
- scputils.changenickname
- scputils_speak.*
```

**Team protection**

CDP = Class-D <br />
CHI = Chaos Insurgency <br />
MTF = MTF Team (included guards) <br />
RIP = Spectators <br />
RSC = Scientist <br />
SCP = SCP <br />
TUT = Tutorial <br />

*Sample Config for team protection:*<br />

In the following example we will protect Class-D against MTF team and Scientist, since they are listed on cuffed_protected_teams they require to be handcuffed to be protected. They also must be in Entrance or Surface to get protection. <br />

```
# You have to add the team you want to protect from the target as key and enemy teams on the list as value, on github documentation you can see all the teams.
cuffed_immunity_players:
CDP:
- MTF
- RSC
# Indicates if the protected teams should be cuffed to get the protection, if you don't add a team it will get protection regardless
cuffed_protected_teams:
- CDP
# Indicates in which zones the protected team is protected, Zone list: Surface, Entrance, HeavyContainment, LightContainment, Unspecified }
cuffed_safe_zones:
CDP:
- Entrance
- Surface
```

<br />Using scputils.* grants every permission that starts with prefix scputils
Using '*' grants every possible permission on the server<br />
To verify if you yml file is valid paste it into this website: http://www.yamllint.com/<br />
Expand Down
48 changes: 48 additions & 0 deletions SCPUtils/Commands/AsnUnwhitelist.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using CommandSystem;


namespace SCPUtils.Commands
{
[CommandHandler(typeof(RemoteAdminCommandHandler))]
[CommandHandler(typeof(GameConsoleCommandHandler))]
public class AsnUnWhitelist : ICommand
{
public string Command { get; } = "scputils_unwhitelist_asn";

public string[] Aliases { get; } = new[] { "asnuw" };

public string Description { get; } = "Un-Whitelist a player to disallow him access the server even if ASN is blacklisted!";

public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
{
if (!CommandExtensions.IsAllowed(((CommandSender)sender).SenderId, "scputils.whitelist") || !((CommandSender)sender).FullPermissions)
{
response = "<color=red> You need a higher administration level to use this command!</color>";
return false;
}
else if (arguments.Count < 1)
{
response = $"<color=yellow>Usage: {Command} <player name/id></color>";
return false;
}

else
{
var target = arguments.Array[1];
var databasePlayer = target.GetDatabasePlayer();

if (databasePlayer == null)
{
response = "<color=yellow>Player not found on Database or Player is loading data!</color>";
return false;
}

databasePlayer.ASNWhitelisted = false;
Database.LiteDatabase.GetCollection<Player>().Update(databasePlayer);
response = "Player has been removed from whitelist!";
return true;
}
}
}
}
48 changes: 48 additions & 0 deletions SCPUtils/Commands/AsnWhitelist.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using CommandSystem;


namespace SCPUtils.Commands
{
[CommandHandler(typeof(RemoteAdminCommandHandler))]
[CommandHandler(typeof(GameConsoleCommandHandler))]
public class AsnWhitelist : ICommand
{
public string Command { get; } = "scputils_whitelist_asn";

public string[] Aliases { get; } = new[] { "asnw" };

public string Description { get; } = "Whitelist a player to make him access the server even if ASN is blacklisted!";

public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
{
if (!CommandExtensions.IsAllowed(((CommandSender)sender).SenderId, "scputils.whitelist") || !((CommandSender)sender).FullPermissions)
{
response = "<color=red> You need a higher administration level to use this command!</color>";
return false;
}
else if (arguments.Count < 1)
{
response = $"<color=yellow>Usage: {Command} <player name/id></color>";
return false;
}

else
{
var target = arguments.Array[1];
var databasePlayer = target.GetDatabasePlayer();

if (databasePlayer == null)
{
response = "<color=yellow>Player not found on Database or Player is loading data!</color>";
return false;
}

databasePlayer.ASNWhitelisted = true;
Database.LiteDatabase.GetCollection<Player>().Update(databasePlayer);
response = "Player has been whitelisted!";
return true;
}
}
}
}
13 changes: 13 additions & 0 deletions SCPUtils/Commands/CommandExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Log = Exiled.API.Features.Log;

namespace SCPUtils.Commands
{
public static class CommandExtensions
{
public static bool IsAllowed(string sender, string permission)
{
Exiled.API.Features.Player player;
return sender != null && (sender == "GAME CONSOLE" || (player = Exiled.API.Features.Player.Get(sender)) == null || Exiled.Permissions.Extensions.Permissions.CheckPermission(player, permission));
}
}
}
Loading

0 comments on commit facd934

Please sign in to comment.