-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandFob.cs
More file actions
69 lines (61 loc) · 2.41 KB
/
CommandFob.cs
File metadata and controls
69 lines (61 loc) · 2.41 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using Rocket.API;
using Rocket.Unturned.Chat;
using Rocket.Unturned.Player;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ekin.EACFOB
{
public class CommandFob : IRocketCommand
{
public AllowedCaller AllowedCaller => AllowedCaller.Player;
public string Name => "fob";
public string Help => "";
public string Syntax => "";
public List<string> Aliases => new List<string>();
public List<string> Permissions => new List<string>();
public void Execute(IRocketPlayer caller, string[] command)
{
UnturnedPlayer val = (UnturnedPlayer)caller;
if(command.Length == 0)
{
UnturnedChat.Say(caller, "How to use: /fob <name>");
return;
}
string key = command[0].ToLower();
var INST = EACFOBPlugin.Instance;
if (!INST.Fobs.ContainsKey(key))
{
UnturnedChat.Say(caller, command[0] + " FOB not found");
return;
}
FobData fobdata = INST.Fobs[key];
bool flag = IRocketPlayerExtension.HasPermission(caller, INST.Configuration.Instance.team1permission);
bool flag2 = IRocketPlayerExtension.HasPermission(caller, INST.Configuration.Instance.team2permission);
bool flag3 = false;
if(fobdata.Type == INST.Configuration.Instance.team1type.ToUpper() && flag)
{
flag3 = true;
}
else if (fobdata.Type == INST.Configuration.Instance.team2type.ToUpper() && flag2)
{
flag3 = true;
}
if (!flag3)
{
UnturnedChat.Say(caller, "You dont have permission to access " + fobdata.Type + " fob");
return;
}
if(INST.TeleportRequests.ContainsKey(val))
{
UnturnedChat.Say(caller, "You already teleporting to another FOB!");
return;
}
TeleportRequest value = new TeleportRequest(val, fobdata);
INST.TeleportRequests[val] = value;
UnturnedChat.Say(caller, "Teleporting to " + fobdata.Name + ", wait for " + INST.Configuration.Instance.teleportcooldown + " seconds.");
}
}
}