Page 1 of 1

If help

PostPosted: 20 Dec 2013, 17:47
by HETAL
Code: Select all
using System.IO;
namespace MCDzienny
{
      public class PlayerJoinHandler : Command
        {
            public override void Init()
           {
      }
          public override void Use(Player p, string message)
      {
                Player.Joined+=
              if (!p.ExtraData.ContainsKey("agree"))
             {
            e.Player.frozen = true;
            e.Player.muted = true;
            Player.SendMessage(e.Player, "Read over the rules and type /agree to agree to them or /disagree to disagree to them.");
            Command.all.Find("rules").Use(e.Player, "");
            }
         else
         {
         e.Player.frozen = false;
            e.Player.muted = false;
           };
      }   
   }   
}

The error is /home/user/MCDzienny/MCDzienny/handler.cs(24,24): Error CS1525: Unexpected symbol `if' (CS1525) (MCDzienny)
This is for a future /agree and /disagree command based on PlayerExtraData

Re: If help

PostPosted: 18 Jan 2014, 14:25
by joppiesaus
you forgot afte Player.Joined += the "{" character, so if you add that, it'll be fixed I think.

Re: If help

PostPosted: 18 Jan 2014, 15:22
by Leeizazombie
Or just use
Code: Select all
public override void Init()
        {
                Player.Joined += (object sender, PlayerEventArgs e) =>
                {
                 
                };
            }