Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 |
|
---|
4 | namespace AllocsFixes.CustomCommands
|
---|
5 | {
|
---|
6 | public class BuffPlayer : ConsoleCmdAbstract
|
---|
7 | {
|
---|
8 | public override string GetDescription ()
|
---|
9 | {
|
---|
10 | return "Apply a buff to a player";
|
---|
11 | }
|
---|
12 |
|
---|
13 | public override string GetHelp () {
|
---|
14 | return "Usage:\n" +
|
---|
15 | " buffplayer <player name / steam id / entity id> <buff name>\n" +
|
---|
16 | "Apply the given buff to the player given by the player name or entity id (as given by e.g. \"lpi\").";
|
---|
17 | }
|
---|
18 |
|
---|
19 | public override string[] GetCommands ()
|
---|
20 | {
|
---|
21 | return new string[] { "buffplayer" };
|
---|
22 | }
|
---|
23 |
|
---|
24 | public override void Execute (List<string> _params, CommandSenderInfo _senderInfo)
|
---|
25 | {
|
---|
26 | try {
|
---|
27 | if (_params.Count != 2) {
|
---|
28 | SdtdConsole.Instance.Output ("Invalid arguments");
|
---|
29 | return;
|
---|
30 | }
|
---|
31 |
|
---|
32 | string buff = _params [1];
|
---|
33 |
|
---|
34 | ClientInfo receiver = ConsoleHelper.ParseParamIdOrName (_params [0]);
|
---|
35 | if (receiver != null) {
|
---|
36 | receiver.SendPackage (new NetPackageConsoleCmdClient ("buff " + buff, true));
|
---|
37 | } else {
|
---|
38 | SdtdConsole.Instance.Output ("Playername or entity ID not found.");
|
---|
39 | }
|
---|
40 | } catch (Exception e) {
|
---|
41 | Log.Out ("Error in BuffPlayer.Run: " + e);
|
---|
42 | }
|
---|
43 | }
|
---|
44 | }
|
---|
45 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.