Noob problem,

Made an plate armor that is only eqquipable by accounts with less than 7 days gametime, but cant get it to work....

Right now it can be equipped by anyone even old accounts

Code:
public override bool OnEquip( Mobile from )
        {
          
                /////////edit for if ACCOUNT is more than 7 days old///////////////////
            Account acct = from.Account as Account;
          
            if (acct != null )
            {
              
            TimeSpan ts = DateTime.UtcNow - acct.Created;
           if (ts.TotalDays < 7)
          {      
          from.SendMessage ("CAN BE EQUIPPED");  //TEST MSG
            return true;

          }
            }
          else
          {
         return false;
       from.SendMessage ("Your acc is TOO OLD TO EQUIP THIS"); //TEST MSG
            }
      
          
                return base.OnEquip( from );
           }

Sorry for disturb im new to this
 
I think you had your else statement grouped with the wrong if statement. Try rearranging them like this:
Code:
        public override bool OnEquip(Mobile from)
        {

            /////////edit for if ACCOUNT is more than 7 days old///////////////////
            Account acct = from.Account as Account;

            if (acct != null)
            {

                TimeSpan ts = DateTime.UtcNow - acct.Created;
                if (ts.TotalDays < 7)
                {
                    from.SendMessage("CAN BE EQUIPPED");  //TEST MSG
                    return true;
                }
                else
                {
                    from.SendMessage("Your acc is TOO OLD TO EQUIP THIS"); //TEST MSG
                    return false;
                }
            }
           


            return false;  // because why?  because account is null that's why
        }
 
Back