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