-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommandCi.cs
106 lines (103 loc) · 2.9 KB
/
CommandCi.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using Rocket.API;
using Rocket.Core;
using Rocket.Unturned.Chat;
using Rocket.Unturned.Player;
using System.Collections.Generic;
using System;
namespace ZaupClearInventoryLib
{
public class CommandCi : IRocketCommand
{
public string Name
{
get
{
return "ci";
}
}
public string Help
{
get
{
return "/ci [name/self] [true] will clears your or someone else's inventory and true will remove clothes too.";
}
}
public string Syntax
{
get
{
return "/ci [name/self] [true]";
}
}
public List<string> Aliases
{
get
{
return new List<string>()
{
"clearinventory",
"cleari"
};
}
}
public List<string> Permissions
{
get
{
return new List<string>()
{
"ci.other",
"ci"
};
}
}
public AllowedCaller AllowedCaller
{
get
{
return AllowedCaller.Player;
}
}
public void Execute(IRocketPlayer caller, string[] msg)
{
UnturnedPlayer playerid = (UnturnedPlayer)caller;
if (msg.Length > 2)
{
UnturnedChat.Say(playerid, "Invalid use of ci.");
return;
}
UnturnedPlayer player = playerid;
if (msg.Length >= 1)
{
if (msg[0].ToLower() != "self")
{
bool hasp = R.Permissions.HasPermission(playerid, "ci.other");
if (!hasp && !playerid.IsAdmin)
{
UnturnedChat.Say(playerid, "You do not have permission to clear someone else's inventory.");
return;
}
player = UnturnedPlayer.FromName(msg[0]);
}
}
bool done = ZaupClearInventoryLib.Instance.ClearInv(player);
if (msg.Length == 2)
{
if (msg[1].ToLower() != "true")
{
UnturnedChat.Say(playerid, "Invalid use of the command. /ci [name/self] [true]");
return;
}
done = ZaupClearInventoryLib.Instance.ClearClothes(player);
}
if (!done)
{
UnturnedChat.Say(playerid, "There was an error. Please look at your console error log.");
}
else
{
UnturnedChat.Say(playerid, player.CharacterName + "'s inventory has been cleared.");
}
}
}
}