-
Notifications
You must be signed in to change notification settings - Fork 1
/
ConsoleCmdSetZombieKills.cs
53 lines (48 loc) · 1.68 KB
/
ConsoleCmdSetZombieKills.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
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace _7DTD_Test
{
public class ConsoleCmdSetZombieKills : ConsoleCmdAbstract
{
public override string[] GetCommands() => new string[1]
{
"setzombiekills"
};
public override bool IsExecuteOnClient => true;
public override string GetDescription()
{
return "Set your zombiekills";
}
public override void Execute(List<string> _params, CommandSenderInfo _senderInfo)
{
if (GameManager.IsDedicatedServer)
{
SingletonMonoBehaviour<SdtdConsole>.Instance.Output("cannot execute setzombiekills on dedicated server, please execute as a client");
return;
}
if (_params.Count < 1)
{
SingletonMonoBehaviour<SdtdConsole>.Instance.Output("setzombiekills requires kills as integer");
}
else
{
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
if (int.TryParse(_params[0], out var result))
{
if ( result <= 0)
{
SingletonMonoBehaviour<SdtdConsole>.Instance.Output("kills must be 1 or more.");
}
else
{
primaryPlayer.KilledZombies = result;
}
}
else
SingletonMonoBehaviour<SdtdConsole>.Instance.Output("kills must be a integer.");
}
}
}
}