This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 1.3.3 first draft - Bump version - Default warps - Revamped player dict - `Warps` command (alternative to `warp list` - `jail [player] (duration in seconds)` command * Update README.md * 1.3.3 second draft * 1.3.3 third draft - Adding `Empty` command, closes #43 - `*` wildcard now works for warping - Removed **__alot__** of unnessesary lines * Update README.md Added: - EMPTY command - JAIL command Changed: - `admintoolbox_debug_player_player_joinANDleave` to `admintoolbox_player_join_info` * 1.3.3 forth draft - Updating to smod 3.1.11 - Readding intercom whitelist - Fixing SetPlayerVariables class - General code improvements * Fixed readme.md & resources.md * Update README.md * Update RESOURCES.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * 1.3.3 fifth draft - Added `admintoolbox_custom_nuke_cards` bool & `admintoolbox_nuke_card_list` List - Renamed duplicate commands - Fixed bugs * Update README.md * Update README.md * Removed debug in IntercomEvent * Update README.md * Update to 1.3.3 * Bump version
- Loading branch information
Showing
30 changed files
with
954 additions
and
713 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,69 @@ | ||
using Smod2.Commands; | ||
using Smod2; | ||
using Smod2.API; | ||
using System; | ||
using System.Linq; | ||
|
||
namespace AdminToolbox.Command | ||
{ | ||
class EmptyCommand : ICommandHandler | ||
{ | ||
public string GetCommandDescription() | ||
{ | ||
return "Empties the player's inventory"; | ||
} | ||
|
||
public string GetUsage() | ||
{ | ||
return "E / EMPTY [Player] (ItemType INT / Delete) (Delete)"; | ||
} | ||
|
||
public string[] OnCall(ICommandSender sender, string[] args) | ||
{ | ||
Server server = PluginManager.Manager.Server; | ||
if (args.Length > 0) | ||
{ | ||
Player myPlayer = GetPlayerFromString.GetPlayer(args[0], out myPlayer); | ||
if (myPlayer == null) { return new string[] { "Couldn't get player: " + args[0] }; ; } | ||
AdminToolbox.AddToPlayerDict(myPlayer); | ||
byte itemNumber = 0; | ||
string[] deleteAliases = { "delete", "del", "d" }; | ||
if (args.Length > 1 && deleteAliases.Contains(args[1].ToLower())) | ||
{ | ||
foreach (Smod2.API.Item item in myPlayer.GetInventory()) | ||
if (item.ItemType != ItemType.NULL) { item.Remove(); itemNumber++; } | ||
myPlayer.SetAmmo(AmmoType.DROPPED_5, 0); | ||
myPlayer.SetAmmo(AmmoType.DROPPED_7, 0); | ||
myPlayer.SetAmmo(AmmoType.DROPPED_9, 0); | ||
return new string[] { "Deleted " + itemNumber + " items from player " + myPlayer.Name + "'s inventory" }; | ||
} | ||
else if (args.Length > 1 && byte.TryParse(args[1], out byte itemInt)) | ||
if (args.Length > 2 && deleteAliases.Contains(args[2].ToLower())) | ||
{ | ||
foreach (Smod2.API.Item item in myPlayer.GetInventory()) | ||
if ((byte)item.ItemType == itemInt) { item.Remove(); itemNumber++; } | ||
return new string[] { "Deleted all \"" + Enum.GetName(typeof(ItemType), itemInt) + "\" items from player " + myPlayer.Name + "'s inventory" }; | ||
} | ||
else | ||
{ | ||
foreach (Smod2.API.Item item in myPlayer.GetInventory()) | ||
if ((byte)item.ItemType == itemInt) { item.Drop(); itemNumber++; } | ||
return new string[] { "Dropped all \"" + Enum.GetName(typeof(ItemType), itemInt) + "\" items from player " + myPlayer.Name + "'s inventory" }; | ||
} | ||
else | ||
{ | ||
foreach (Smod2.API.Item item in myPlayer.GetInventory()) | ||
if (item.ItemType != ItemType.NULL) { item.Drop(); itemNumber++; } | ||
PluginManager.Manager.Server.Map.SpawnItem(ItemType.DROPPED_5, myPlayer.GetPosition(), myPlayer.GetRotation()); | ||
PluginManager.Manager.Server.Map.SpawnItem(ItemType.DROPPED_7, myPlayer.GetPosition(), myPlayer.GetRotation()); | ||
PluginManager.Manager.Server.Map.SpawnItem(ItemType.DROPPED_9, myPlayer.GetPosition(), myPlayer.GetRotation()); | ||
myPlayer.SetAmmo(AmmoType.DROPPED_5, 0); | ||
myPlayer.SetAmmo(AmmoType.DROPPED_5, 0); | ||
myPlayer.SetAmmo(AmmoType.DROPPED_5, 0); | ||
return new string[] { "Dropped " + itemNumber + " items from player " + myPlayer.Name + "'s inventory" }; | ||
} | ||
} | ||
return new string[] { GetUsage() }; | ||
} | ||
} | ||
} |
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.