Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
1.3.5 Update (#59)
Browse files Browse the repository at this point in the history
* 1.3.5 First commit

Adding: `admintoolbox_friendlyfire_damagemultiplier` float config
 - `admintoolbox_tracking` bool config

Fixes:
 - Code improvements
 - Fixed warpvectors refrence mistake, closing #51

* 1.3.5 second commit

 - Replacing all spaces with tabs (because screw spaces)
 - New Appdata folder structure
   - Added code to move old server logs to said new folders
 - Writing player stats (Kills/TeamKills/Deaths) to file, read upon player join
 - Moved roundcount++ to OnRoundRestart, makes the server start on round 1

* Add KillCommand.cs

* 1.3.5 third commit

 - Player command now can be used with PlayerID, closes #54
 - New WarpVector "topsitedoor" by request
 - Stats writing to file
 - Intercom speechtime set to 0 (or below) defaults to 5 minutes (300 seconds)

* Add ATBAN command

 - Adding handcuff immunity for godmode players + tutorials
    - Config to let tutorials be handcuffed

* Re-adding Kill/Slay command + fixes

* 1.3.5 fourth commit

 - Added PlayTime to player stats
 - Added dict clear for missing steamID's with keepsettings off
 - Added `admintoolbox_roledamageblock_onroundend` , closing #52
 - Fixed ATBan spaces which should have been tabs

* Updated readme to new 3.1.5 features
  • Loading branch information
Rnen authored Aug 25, 2018
1 parent 9247e86 commit ef8ca3c
Show file tree
Hide file tree
Showing 35 changed files with 2,771 additions and 2,450 deletions.
1,186 changes: 639 additions & 547 deletions AdminToolbox/AdminToolbox/AdminToolbox.cs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions AdminToolbox/AdminToolbox/AdminToolbox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Commands\ATBanCommand.cs" />
<Compile Include="Commands\IntercomLockCommand.cs" />
<Compile Include="Commands\ATDisableCommand.cs" />
<Compile Include="Commands\KeepSettingsCommand.cs" />
<Compile Include="Commands\BreakDoorsCommand.cs" />
<Compile Include="Commands\InstantKillCommand.cs" />
<Compile Include="Commands\KillCommand.cs" />
<Compile Include="Commands\LockdownCommand.cs" />
<Compile Include="Commands\DoorCommand.cs" />
<Compile Include="Commands\ATColorCommand.cs" />
Expand Down
67 changes: 67 additions & 0 deletions AdminToolbox/AdminToolbox/Commands/ATBanCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using System;
using System.IO;
using Smod2;
using Smod2.API;
using Smod2.Commands;

namespace AdminToolbox.Command
{
public class ATBanCommand : ICommandHandler
{

private Plugin plugin;

public ATBanCommand(Plugin plugin)
{
this.plugin = plugin;
}

public string GetUsage()
{
return "ATBAN [NAME] [IP/SteamID] [MINUTES]";
}

public string GetCommandDescription()
{
return "Alternative ban for offline users";
}

public string[] OnCall(ICommandSender sender, string[] args)
{
try
{
if (args.Length != 3) return new string[] { GetUsage() };
string ipBanPath = FileManager.AppFolder + "IpBans.txt";
string sidBanPath = FileManager.AppFolder + "SteamIdBans.txt";
string outs = "";
string IssuingPlayer = (sender is Player pl && !string.IsNullOrEmpty(pl.SteamId)) ? pl.Name : "Server";
DateTime bannedTime; ;
if (double.TryParse(args[2], out var minutes))
bannedTime = DateTime.Now.AddMinutes(minutes);
else
return new string[] { "Wrong time format: " + args[2] };

if (args[1].Contains("."))
{
if (args[1].Split('.').Length != 4) return new string[] { "Invalid IP: " + args[1] };
string ip = (args[1].Contains("::ffff:")) ? args[1] : "::ffff:" + args[1];
outs += args[0] + ";" + ip + ";" + bannedTime.Ticks + ";;" + IssuingPlayer + ";" + DateTime.Now.Ticks;
File.AppendAllText(ipBanPath, "\n" + outs);
if (IssuingPlayer != "Server") plugin.Info("Player with name: " + args[0] + " and with IP: " + args[1] + " was banned for " + args[2] + " minutes by " + IssuingPlayer);
return new string[] { "Player with name: " + args[0] + " and with IP: " + args[1] + " was banned for " + args[2] + " minutes by " + IssuingPlayer };
}
else
{
outs += args[0] + ";" + args[1] + ";" + bannedTime.Ticks + ";;" + IssuingPlayer + ";" + DateTime.Now.Ticks;
File.AppendAllText(sidBanPath, "\n" + outs);
if (IssuingPlayer != "Server") plugin.Info("Player with name: " + args[0] + " and with SteamID: " + args[1] + " was banned for " + args[2] + " minutes by " + IssuingPlayer);
return new string[] { "Player with name: " + args[0] + " and with SteamID: " + args[1] + " was banned for " + args[2] + " minutes by " + IssuingPlayer };
}
}
catch (Exception e)
{
return new string[] { e.StackTrace };
}
}
}
}
94 changes: 47 additions & 47 deletions AdminToolbox/AdminToolbox/Commands/ATColorCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,55 @@

namespace AdminToolbox.Command
{
class ATColorCommand : ICommandHandler
{
private AdminToolbox plugin;
class ATColorCommand : ICommandHandler
{
private AdminToolbox plugin;

public ATColorCommand(AdminToolbox plugin)
{
this.plugin = plugin;
}
public ATColorCommand(AdminToolbox plugin)
{
this.plugin = plugin;
}

public string GetCommandDescription()
{
return "Enables/Disables color for Admintoolbox in the server window";
}
public string GetCommandDescription()
{
return "Enables/Disables color for Admintoolbox in the server window";
}

public string GetUsage()
{
return "ATCOLOR (bool)";
}
public string GetUsage()
{
return "ATCOLOR (bool)";
}

public string[] OnCall(ICommandSender sender, string[] args)
{
Server server = PluginManager.Manager.Server;
if (args.Length >= 1)
{
if (bool.TryParse(args[0], out bool x))
{
AdminToolbox.isColored = x;
AdminToolbox.isColoredCommand = true;
if (AdminToolbox.isColored)
plugin.Info("@#fg=Yellow;AdminToolbox@#fg=Default; colors is set to @#fg=Green;" + AdminToolbox.isColored + "@#fg=Default;");
else
plugin.Info("AdminToolbox colors set to" + AdminToolbox.isColored);
return new string[] { "AdminToolbox colors set to" + AdminToolbox.isColored };
}
else
return new string[] { "\"ATCOLOR "+ args[0] +"\" is not a valid bool" };
}
else if (args.Length == 0)
{
AdminToolbox.isColored = !AdminToolbox.isColored;
AdminToolbox.isColoredCommand = true;
if (AdminToolbox.isColored)
plugin.Info("@#fg=Yellow;AdminToolbox@#fg=Default; colors is set to @#fg=Green;"+AdminToolbox.isColored+"@#fg=Default;");
else
plugin.Info("AdminToolbox colors set to "+AdminToolbox.isColored);
return new string[] { "AdminToolbox colors set to " + AdminToolbox.isColored };
}
else
return new string[] { GetUsage() };
}
public string[] OnCall(ICommandSender sender, string[] args)
{
Server server = PluginManager.Manager.Server;
if (args.Length >= 1)
{
if (bool.TryParse(args[0], out bool x))
{
AdminToolbox.isColored = x;
AdminToolbox.isColoredCommand = true;
if (AdminToolbox.isColored)
plugin.Info("@#fg=Yellow;AdminToolbox@#fg=Default; colors is set to @#fg=Green;" + AdminToolbox.isColored + "@#fg=Default;");
else
plugin.Info("AdminToolbox colors set to" + AdminToolbox.isColored);
return new string[] { "AdminToolbox colors set to" + AdminToolbox.isColored };
}
else
return new string[] { "\"ATCOLOR " + args[0] + "\" is not a valid bool" };
}
else if (args.Length == 0)
{
AdminToolbox.isColored = !AdminToolbox.isColored;
AdminToolbox.isColoredCommand = true;
if (AdminToolbox.isColored)
plugin.Info("@#fg=Yellow;AdminToolbox@#fg=Default; colors is set to @#fg=Green;" + AdminToolbox.isColored + "@#fg=Default;");
else
plugin.Info("AdminToolbox colors set to " + AdminToolbox.isColored);
return new string[] { "AdminToolbox colors set to " + AdminToolbox.isColored };
}
else
return new string[] { GetUsage() };
}
}
}
}
44 changes: 22 additions & 22 deletions AdminToolbox/AdminToolbox/Commands/ATDisableCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@

namespace AdminToolbox.Command
{
class ATDisableCommand : ICommandHandler
{
private AdminToolbox plugin;
class ATDisableCommand : ICommandHandler
{
private AdminToolbox plugin;

public ATDisableCommand(AdminToolbox plugin)
{
this.plugin = plugin;
}
public ATDisableCommand(AdminToolbox plugin)
{
this.plugin = plugin;
}

public string GetCommandDescription()
{
return "Disables Admintoolbox";
}
public string GetCommandDescription()
{
return "Disables Admintoolbox";
}

public string GetUsage()
{
return "ATDISABLE";
}
public string GetUsage()
{
return "ATDISABLE";
}

public string[] OnCall(ICommandSender sender, string[] args)
{
plugin.Info(sender + " ran the " + GetUsage() + " command!");
this.plugin.pluginManager.DisablePlugin(this.plugin);
return new string[] { "AdminToolbox Disabled" };
}
public string[] OnCall(ICommandSender sender, string[] args)
{
plugin.Info(sender + " ran the " + GetUsage() + " command!");
this.plugin.pluginManager.DisablePlugin(this.plugin);
return new string[] { "AdminToolbox Disabled" };
}
}
}
}
132 changes: 66 additions & 66 deletions AdminToolbox/AdminToolbox/Commands/BreakDoorsCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,71 +17,71 @@ public string GetUsage()
return "BREAKDOOR [PLAYER] [BOOLEAN]";
}

public string[] OnCall(ICommandSender sender, string[] args)
{
AdminToolbox.AddMissingPlayerVariables();
Server server = PluginManager.Manager.Server;
if (args.Length > 0)
{
if (args[0].ToLower() == "all" || args[0].ToLower() == "*")
{
if (args.Length > 1)
{
if (bool.TryParse(args[1], out bool j))
{
string outPut = null;
int playerNum = 0;
foreach (Player pl in server.GetPlayers())
{
AdminToolbox.playerdict[pl.SteamId].destroyDoor = j;
playerNum++;
}
outPut += "\nSet " + playerNum + " player's BreakDoors to " + j;
return new string[] { "\nSet " + playerNum + " player's BreakDoors to " + j };
}
else
return new string[] { "Not a valid bool!" };
}
else
{
foreach (Player pl in server.GetPlayers()) { AdminToolbox.playerdict[pl.SteamId].destroyDoor = !AdminToolbox.playerdict[pl.SteamId].destroyDoor; }
return new string[] { "Toggled all players BreakDoors" };
}
}
else if (args[0].ToLower() == "list" || args[0].ToLower() == "get")
{
string str = "\nPlayers with BreakDoors enabled: \n";
List<string> myPlayerList = new List<string>();
foreach (Player pl in server.GetPlayers())
{
if (AdminToolbox.playerdict[pl.SteamId].destroyDoor)
myPlayerList.Add(pl.Name);
}
if (myPlayerList.Count > 0)
{
myPlayerList.Sort();
foreach (var item in myPlayerList)
str += "\n - " + item;
}
else str = "\nNo players with \"BreakDoors\" enabled!";
return new string[] { str };
}
Player myPlayer = GetPlayerFromString.GetPlayer(args[0], out myPlayer);
if (myPlayer == null) { return new string[] { "Couldn't find player: " + args[0] }; }
if (args.Length > 1)
{
if (args[1].ToLower() == "on" || args[1].ToLower() == "true") { AdminToolbox.playerdict[myPlayer.SteamId].destroyDoor = true; }
else if (args[1].ToLower() == "off" || args[1].ToLower() == "false") { AdminToolbox.playerdict[myPlayer.SteamId].destroyDoor = false; }
return new string[] { myPlayer.Name + " BreakDoors: " + AdminToolbox.playerdict[myPlayer.SteamId].destroyDoor };
}
else
{
AdminToolbox.playerdict[myPlayer.SteamId].destroyDoor = !AdminToolbox.playerdict[myPlayer.SteamId].destroyDoor;
return new string[] { myPlayer.Name + " BreakDoors: " + AdminToolbox.playerdict[myPlayer.SteamId].destroyDoor };
}
public string[] OnCall(ICommandSender sender, string[] args)
{
AdminToolbox.AddMissingPlayerVariables();
Server server = PluginManager.Manager.Server;
if (args.Length > 0)
{
if (args[0].ToLower() == "all" || args[0].ToLower() == "*")
{
if (args.Length > 1)
{
if (bool.TryParse(args[1], out bool j))
{
string outPut = null;
int playerNum = 0;
foreach (Player pl in server.GetPlayers())
{
AdminToolbox.playerdict[pl.SteamId].destroyDoor = j;
playerNum++;
}
outPut += "Set " + playerNum + " player's BreakDoors to " + j;
return new string[] { "Set " + playerNum + " player's BreakDoors to " + j };
}
else
return new string[] { "Not a valid bool!" };
}
else
{
foreach (Player pl in server.GetPlayers()) { AdminToolbox.playerdict[pl.SteamId].destroyDoor = !AdminToolbox.playerdict[pl.SteamId].destroyDoor; }
return new string[] { "Toggled all players BreakDoors" };
}
}
else if (args[0].ToLower() == "list" || args[0].ToLower() == "get")
{
string str = "Players with BreakDoors enabled: \n";
List<string> myPlayerList = new List<string>();
foreach (Player pl in server.GetPlayers())
{
if (AdminToolbox.playerdict[pl.SteamId].destroyDoor)
myPlayerList.Add(pl.Name);
}
if (myPlayerList.Count > 0)
{
myPlayerList.Sort();
foreach (var item in myPlayerList)
str += "\n - " + item;
}
else str = "No players with \"BreakDoors\" enabled!";
return new string[] { str };
}
Player myPlayer = GetPlayerFromString.GetPlayer(args[0]);
if (myPlayer == null) { return new string[] { "Couldn't find player: " + args[0] }; }
if (args.Length > 1)
{
if (args[1].ToLower() == "on" || args[1].ToLower() == "true") { AdminToolbox.playerdict[myPlayer.SteamId].destroyDoor = true; }
else if (args[1].ToLower() == "off" || args[1].ToLower() == "false") { AdminToolbox.playerdict[myPlayer.SteamId].destroyDoor = false; }
return new string[] { myPlayer.Name + " BreakDoors: " + AdminToolbox.playerdict[myPlayer.SteamId].destroyDoor };
}
else
{
AdminToolbox.playerdict[myPlayer.SteamId].destroyDoor = !AdminToolbox.playerdict[myPlayer.SteamId].destroyDoor;
return new string[] { myPlayer.Name + " BreakDoors: " + AdminToolbox.playerdict[myPlayer.SteamId].destroyDoor };
}

}
return new string[] { GetUsage() };
}
}
return new string[] { GetUsage() };
}
}
}
}
Loading

0 comments on commit ef8ca3c

Please sign in to comment.