source: binary-improvements/AllocsCommands/Commands/BuffPlayer.cs@ 283

Last change on this file since 283 was 253, checked in by alloc, 9 years ago

Fixes 6_8_10

File size: 1.1 KB
Line 
1using System;
2using System.Collections.Generic;
3
4namespace 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.