/punch

/punch

Postby Breakdown901 » 11 Jul 2013, 11:11

Code: Select all
//Made by Breakdown901
using System;
namespace MCDzienny
{
   public class CmdPunch : Command
   {
      public override string name { get { return "punch"; } }
      public override string shortcut { get { return "pu"; } }
      public override string type { get { return "other"; } }
      public override bool museumUsable { get { return false; } }
      public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
      public override void Use(Player p, string message)
      {
                 if (message == "") { Help(p); return; }

         Player who = Player.Find(message.Split(' ')[0]);
                        if (who == null)
{
   Player.SendMessage(p, "Player is not online.");
   return;
}
else
      {
                 Player.GlobalChat(p, who.color + who.name + "punched" + Server.DefaultColor + p.color + p.name, false);
                }
             
            }             

      public override void Help(Player p)
      {
         Player.SendMessage(p, "/punch - Punch someone.");
      }
   }
}


Just like to say thanks to Hetal, I was using your "brofist" command as a sort of walkthrough on how to make it so I hope your okay with that. Also, I'd like to thank joppiesaus for giving me the method for offline players.
Owner of:
Breakdown901 Lava Survival/Zombie Survival/Freebuild
Host of NeonGaming Lava Survival.
Breakdown901
 
Posts: 320
Joined: 24 May 2013, 12:54

Re: /punch

Postby Breakdown901 » 11 Jul 2013, 11:14

Noticed some errors, I'll fix them in a few minutes.
Owner of:
Breakdown901 Lava Survival/Zombie Survival/Freebuild
Host of NeonGaming Lava Survival.
Breakdown901
 
Posts: 320
Joined: 24 May 2013, 12:54

Re: /punch

Postby Breakdown901 » 11 Jul 2013, 11:22

I'm confused by this, I know I put the Server.DefaultColor in the wrong place, but all the words are bunched up together and I dont know why. This is the v2, but the words are bunched up when you use /punch:

Code: Select all
using System;
namespace MCDzienny
{
   public class CmdPunch : Command
   {
      public override string name { get { return "punch"; } }
      public override string shortcut { get { return "pu"; } }
      public override string type { get { return "other"; } }
      public override bool museumUsable { get { return false; } }
      public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
      public override void Use(Player p, string message)
      {
                 if (message == "") { Help(p); return; }

         Player who = Player.Find(message.Split(' ')[0]);
                        if (who == null)
{
   Player.SendMessage(p, "Player is not online.");
   return;
}
else
      {
                 Player.GlobalChat(p,  who.color +  who.name +  Server.DefaultColor + "punched" +  p.color +  p.name, false);
                }
             
            }             

      public override void Help(Player p)
      {
         Player.SendMessage(p, "/punch - Punch someone.");
      }
   }
}
Owner of:
Breakdown901 Lava Survival/Zombie Survival/Freebuild
Host of NeonGaming Lava Survival.
Breakdown901
 
Posts: 320
Joined: 24 May 2013, 12:54

Re: /punch

Postby Breakdown901 » 11 Jul 2013, 13:19

Havent tested it yet but everything should work.
v3:

Code: Select all
using System;
namespace MCDzienny
{
   public class CmdPunch : Command
   {
      public override string name { get { return "punch"; } }
      public override string shortcut { get { return "pu"; } }
      public override string type { get { return "other"; } }
      public override bool museumUsable { get { return false; } }
      public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
      public override void Use(Player p, string message)
      {
                 if (message == "") { Help(p); return; }

         Player who = Player.Find(message.Split(' ')[0]);
                        if (who == null)
{
   Player.SendMessage(p, "Player is not online.");
   return;
}
else
      {
                 Player.GlobalChat(p,  who.color +  who.name +  Server.DefaultColor + " punched " +  p.color +  p.name, false);
                }
             
            }             

      public override void Help(Player p)
      {
         Player.SendMessage(p, "/punch - Punch someone.");
      }
   }
}
Owner of:
Breakdown901 Lava Survival/Zombie Survival/Freebuild
Host of NeonGaming Lava Survival.
Breakdown901
 
Posts: 320
Joined: 24 May 2013, 12:54

Re: /punch

Postby Breakdown901 » 11 Jul 2013, 15:41

Lol, v4:

Code: Select all
using System;
namespace MCDzienny
{
   public class CmdPunch : Command
   {
      public override string name { get { return "punch"; } }
      public override string shortcut { get { return "pu"; } }
      public override string type { get { return "other"; } }
      public override bool museumUsable { get { return false; } }
      public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
      public override void Use(Player p, string message)
      {
                 if (message == "") { Help(p); return; }

         Player who = Player.Find(message.Split(' ')[0]);
                        if (who == null)
{
   Player.SendMessage(p, "Player is not online.");
   return;
}
else
      {
                 Player.GlobalChat(p,  p.color + p.name +  Server.DefaultColor + " punched " +  who.color +  who.name, false);
                }
             
            }             

      public override void Help(Player p)
      {
         Player.SendMessage(p, "/punch - Punch someone.");
      }
   }
}
Owner of:
Breakdown901 Lava Survival/Zombie Survival/Freebuild
Host of NeonGaming Lava Survival.
Breakdown901
 
Posts: 320
Joined: 24 May 2013, 12:54

Re: /punch

Postby Clowny » 14 Jul 2013, 18:14

Nice I'm going to use this to help me develop some commands :D
Founder Of MC Classic Hosting Community http://mcclassichosting.webs.com
Founder of MC Classic Software MCReborn http://mcreborn.tk
Professional Hoster and Basic C# Coder
Image
User avatar
Clowny
 
Posts: 112
Joined: 14 Jul 2013, 03:53

Re: /punch

Postby Lmfao » 17 Jul 2013, 15:48

this is gonna help me to
User avatar
Lmfao
 
Posts: 11
Joined: 16 Jul 2013, 23:07

Re: /punch

Postby Ultima » 29 Jul 2013, 17:54

I got a beter version which actually punches.

viewtopic.php?f=19&t=2504
User avatar
Ultima
 
Posts: 953
Joined: 19 Aug 2011, 23:45


Return to Custom Commands

Who is online

Users browsing this forum: No registered users and 4 guests

cron