ItsMods

Full Version: !kill
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
just a command that kills the player like !kill playername ?
easy
CSHARP Code
  1. using System;
  2. using Addon;
  3.  
  4. namespace tralalal1
  5. {
  6. public class Class1:CPlugin
  7. {
  8. public override ChatType OnSay(string Message, ServerClient Client, bool Teamchat)
  9. {
  10. if (Message.ToLower().StartsWith("!kill"))
  11. {
  12. string[] options = Message.Split(' ');
  13. if (options.Length == 1)
  14. KillPlayer(Client.ClientNum, Client.ClientNum, Client.Other.CurrentWeapon, string.Empty);
  15. else if (options.Length == 2)
  16. {
  17. ServerClient Victim = Client;
  18. if (GetClients() != null)
  19. {
  20. foreach (ServerClient client in GetClients())
  21. {
  22. if (client.Name.ToLower().Contains(options[1].ToLower()))
  23. Victim = client;
  24. }
  25. }
  26. if (Victim != Client)
  27. KillPlayer(Client.ClientNum, Victim.ClientNum, Client.Other.CurrentWeapon, string.Empty);
  28. else
  29. TellClient(Client.ClientNum, "^2Kill plugin error:Couldn't find the player", true);
  30. }
  31. else
  32. {
  33. TellClient(Client.ClientNum, "^3Wrong options try again", true);
  34. }
  35. return ChatType.ChatNone;
  36. }
  37. else
  38. return ChatType.ChatContinue;
  39. }
  40. }
  41. }

If no player name is given kills the caller itself
why not suicide player? its much easier.
(09-20-2012, 06:22)OzonE Wrote: [ -> ]why not suicide player? its much easier.

anyway to do this so it doesn't show as playername killed playername ??
There's a killplayer function now? Sweet!
just found out, this command is available to all users, even though it says permission denied etc they can still use it
i added the same thing in GP , but im using suicide player. all you need is client num.
the similar thing is now added to God Plugin 4.0.1.