-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemoteCommandScript.cs
More file actions
46 lines (36 loc) · 1.48 KB
/
RemoteCommandScript.cs
File metadata and controls
46 lines (36 loc) · 1.48 KB
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
//MCCScript 1.0
MCC.LoadBot(new RemoteCommandBot());
//MCCScript Extensions
public class RemoteCommandBot : ChatBot
{
private string allowedPlayer = "LorNople";
public override void Initialize()
{
LogToConsole("========================================");
LogToConsole("[RemoteCmd] Bot yuklendi!");
LogToConsole("[RemoteCmd] Komut alacak oyuncu: " + allowedPlayer);
LogToConsole("[RemoteCmd] Durdurmak icin: /bots");
LogToConsole("[RemoteCmd] Sonra: /bot RemoteCommandBot unload");
LogToConsole("========================================");
}
public override void GetText(string text)
{
string cleanText = GetVerbatim(text);
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(
@"\[" + allowedPlayer + @"\s*->\s*Sen\]\s*(.+)$",
System.Text.RegularExpressions.RegexOptions.IgnoreCase
);
System.Text.RegularExpressions.Match match = regex.Match(cleanText);
if (match.Success)
{
string command = match.Groups[1].Value.Trim();
LogToConsole("[RemoteCmd] " + allowedPlayer + " komut gonderdi: " + command);
if (command.StartsWith("/"))
{
command = command.Substring(1);
}
PerformInternalCommand(command);
LogToConsole("[RemoteCmd] Komut calistirildi: " + command);
}
}
}