i have no idea why validate has this error.

        public bool Validate ()
        {
            ItemPutUp = 0;

            List<string> errors = new List<string> ();

            foreach (ulong id in Trade.OtherOfferedItems)
            {
                var item = Trade.OtherInventory.GetItem(id);
                if (item.Defindex == 647)
                    ItemPutUp += 72;
                else if (item.Defindex == 347)
                    ItemPutUp += 180;
                else if (item.Defindex == 30085)
                    ItemPutUp += 36;
                else if (item.Defindex == 30177)
                    ItemPutUp += 63;
                else if (item.Defindex == 30131)
                    ItemPutUp += 33;
                else if (item.Defindex == 5001)
                    ItemPutUp += 81;
                else if (item.Defindex == 30089)
                    ItemPutUp += 30;
                else if (item.Defindex == 30076)
                    ItemPutUp += 36;
                else
                {
                    var schemaItem = Trade.CurrentSchema.GetItem(item.Defindex);
                    errors.Add("Item " + schemaItem.Name + " is currently not being purchased.");
                }

            }

            if (ItemPutUp < 1)
            {
                errors.Add("You must put up at least 1 item.");
            }

            // send the errors
            if (errors.Count != 0)
                Trade.SendMessage("There were errors in your trade: ");
            foreach (string error in errors)
            {
                Trade.SendMessage(error);
            }

        }

Recommended Answers

All 3 Replies

There's no return statement, yet the method is supposed to return bool...

commented: Bob-on +7

Your function is not returning any boolean value as it is written to.

Just to add with @deceptikon,

when an if statement is written in a function, then all the paths(i.e., if statements) must return a value, other than the common return value of the function.

Hope this helps you..

Have a happy coding...:-D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.