Rev | Line | |
---|
[224] | 1 | using System.Collections.Generic;
|
---|
| 2 |
|
---|
[325] | 3 | namespace AllocsFixes.CustomCommands {
|
---|
| 4 | public class SayToPlayer : ConsoleCmdAbstract {
|
---|
| 5 | public override string GetDescription () {
|
---|
[224] | 6 | return "send a message to a single player";
|
---|
| 7 | }
|
---|
| 8 |
|
---|
[238] | 9 | public override string GetHelp () {
|
---|
| 10 | return "Usage:\n" +
|
---|
[325] | 11 | " pm <player name / steam id / entity id> <message>\n" +
|
---|
| 12 | "Send a PM to the player given by the player name or entity id (as given by e.g. \"lpi\").";
|
---|
[238] | 13 | }
|
---|
| 14 |
|
---|
[325] | 15 | public override string[] GetCommands () {
|
---|
| 16 | return new[] {"sayplayer", "pm"};
|
---|
[224] | 17 | }
|
---|
| 18 |
|
---|
[325] | 19 | private void RunInternal (ClientInfo _sender, List<string> _params) {
|
---|
[230] | 20 | if (_params.Count < 2) {
|
---|
| 21 | SdtdConsole.Instance.Output ("Usage: sayplayer <playername|entityid> <message>");
|
---|
[224] | 22 | return;
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | string message = _params [1];
|
---|
| 26 |
|
---|
[230] | 27 | ClientInfo receiver = ConsoleHelper.ParseParamIdOrName (_params [0]);
|
---|
[224] | 28 | if (receiver != null) {
|
---|
[230] | 29 | Chat.SendMessage (receiver, _sender, message);
|
---|
[224] | 30 | } else {
|
---|
[230] | 31 | SdtdConsole.Instance.Output ("Playername or entity ID not found.");
|
---|
[224] | 32 | }
|
---|
| 33 | }
|
---|
| 34 |
|
---|
[325] | 35 | public override void Execute (List<string> _params, CommandSenderInfo _senderInfo) {
|
---|
[359] | 36 | if (_senderInfo.RemoteClientInfo != null) {
|
---|
| 37 | RunInternal (_senderInfo.RemoteClientInfo, _params);
|
---|
| 38 | } else {
|
---|
| 39 | RunInternal (null, _params);
|
---|
[224] | 40 | }
|
---|
| 41 | }
|
---|
| 42 | }
|
---|
[325] | 43 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.