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