/autorules

/autorules

Postby Breakdown901 » 14 Jul 2013, 20:10

I tried to make a command using the Player Joined Event, it compiled and loaded fine but when I joined the server nothing happened.

Code: Select all
//Made by Breakdown901
using System;
namespace MCDzienny
{
   public class CmdAutorules : Command
   {
      public override string name { get { return "autorules"; } }
      public override string shortcut { get { return "ar"; } }
      public override string type { get { return "mod"; } }
      public override bool museumUsable { get { return false; } }
      public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
      public override void Use(Player p, string message)
      {
          Player.Joined += (object sender, PlayerEventArgs e) =>
          {
              Command.all.Find("rules").Use(p, p.name);
         }; 
         
      }                                                                         

      public override void Help(Player p)
      {
         Player.SendMessage(p, "/autorules - Automatically sends rules to player when they join.");
      }
   }
}
Owner of:
Breakdown901 Lava Survival/Zombie Survival/Freebuild
Host of NeonGaming Lava Survival.
Breakdown901
 
Posts: 320
Joined: 24 May 2013, 12:54

Re: /autorules

Postby Clowny » 14 Jul 2013, 20:15

Wait so what you're trying to do is every time a player logs in.. the rules automatically pop up? Would that even be.. a command hmm
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: /autorules

Postby ismellike » 14 Jul 2013, 20:37

You have to put the Player.Joined event inside of this

Code: Select all
public override void Init()
{
   //your player event
}
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: /autorules

Postby ane200055 » 14 Jul 2013, 20:42

Emm, It looks like alright idea, What I would do though is copy the text from rules.txt and put it into welcome.txt .
But the good thing with this way if you add a rule it will show up when joined without adding twice.
Good job. :)
Website: http://ane200055.co.vu
The Developer of The XtraIRC IRC Client: http://xtrairc.tk
C# coder.
User avatar
ane200055
 
Posts: 98
Joined: 30 Jun 2013, 09:07
Location: United Kingdom

Re: /autorules

Postby Clowny » 14 Jul 2013, 20:59

ane200055 wrote:Emm, It looks like alright idea, What I would do though is copy the text from rules.txt and put it into welcome.txt .
But the good thing with this way if you add a rule it will show up when joined without adding twice.
Good job. :)

That's what I was thinking haha
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


Return to Help in Coding

Who is online

Users browsing this forum: No registered users and 1 guest

cron