ServUO Version
Publish Unknown
Ultima Expansion
None
Hey im trying to check the attachment count on a player, im using old runuo 2.2, im getting some error, thanks

List:
////CHECKING IF THE PLAYER HAS ALREADY 3 IDENTITIES IF SO, WE RETURN
 ArrayList a = XmlAttach.FindAttachments(from);

                if (a != null)
                {
                    foreach (XmlAttachment x in a)
                    {
                        if (x is XmlLocalVariable && x != null && !x.Deleted)
                        {
                            if (x.Count >= 3)  //3
                            {
                                 Console.WriteLine("x Count {0} ",x.Count.ToString());
                                return;
                            }
                          
                            ////END OF CHECKING IF THE PLAYER HAS ALREADY 3 IDENTITIES IF SO, WE RETURN
                            else;
                            {
                                // nothing
                            }
                          
                        }
                    }
                }

Errorserror.png
 
I'm not sure if this is the issue or not as I've never messed around with xmlspawner code, but from the error message, it seems to me your missing the using System.Linq; as Count is from Linq addition to c#
 
Well I am not sure what the intention was behind most of the code, but
C#:
if (XmlAttach.FindAttachments(from).Count >= 3)
{
    Console.WriteLine("x Count {0} ",XmlAttach.FindAttachments(from).Count);
    return;
}

should be what you are after?
 
Back