source: binary-improvements/7dtd-server-fixes/src/CustomCommands/Kill.cs@ 164

Last change on this file since 164 was 130, checked in by alloc, 10 years ago

Fixes

File size: 1.0 KB
RevLine 
[112]1using System;
2using System.Collections.Generic;
3
[130]4namespace 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);
38 p.DamageEntity (new DamageSource (EnumDamageSourceType.Bullet), 9999);
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.