Rev | Line | |
---|
[112] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 |
|
---|
[130] | 4 | namespace AllocsFixes.CustomCommands
|
---|
[112] | 5 | {
|
---|
[130] | 6 | public class Kill : ConsoleCommand
|
---|
[112] | 7 | {
|
---|
[130] | 8 | public Kill (ConsoleSdtd cons) : base(cons)
|
---|
| 9 | {
|
---|
| 10 | }
|
---|
[112] | 11 |
|
---|
[130] | 12 | public override string Description ()
|
---|
| 13 | {
|
---|
| 14 | return "kill a given player (entity id or name)";
|
---|
| 15 | }
|
---|
[112] | 16 |
|
---|
[130] | 17 | public override string[] Names ()
|
---|
| 18 | {
|
---|
| 19 | return new string[] { "kill", string.Empty };
|
---|
| 20 | }
|
---|
[112] | 21 |
|
---|
[130] | 22 | public override void Run (string[] _params)
|
---|
| 23 | {
|
---|
| 24 | try {
|
---|
| 25 | if (_params.Length != 1) {
|
---|
| 26 | m_Console.SendResult ("Usage: kill <playername|entityid>");
|
---|
| 27 | return;
|
---|
| 28 | }
|
---|
[112] | 29 |
|
---|
[130] | 30 | ClientInfo ci = CommonMappingFunctions.GetClientInfoFromNameOrID (_params [0], false);
|
---|
[112] | 31 |
|
---|
[130] | 32 | if (ci == null) {
|
---|
| 33 | m_Console.SendResult ("Playername or entity id not found.");
|
---|
| 34 | return;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | EntityPlayer p = CommonMappingFunctions.GetEntityPlayer (ci);
|
---|
[203] | 38 | p.DamageEntity (new DamageSource (EnumDamageSourceType.Bullet), 9999, false);
|
---|
[130] | 39 | m_Console.SendResult ("Killed player " + _params [0]);
|
---|
| 40 | } catch (Exception e) {
|
---|
| 41 | Log.Out ("Error in Kill.Run: " + e);
|
---|
[112] | 42 | }
|
---|
[114] | 43 | }
|
---|
[112] | 44 | }
|
---|
| 45 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.