sahisahi
Member
Have a item that when player doubleclick it removes guards from a region i made this
And added
to the ondoubleclick method.
Server crash when i doubleclick the item:
Exception:
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext()
at Server.Items.Nogd.No_Guard()
at Server.Items.Nogd.OnDoubleClick(Mobile from)
at Server.Mobile.Use(Item item)
at Server.Engines.XmlSpawner2.XmlAttach.UseReq(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)
Thanks!
Code:
public static void No_Guard()
{
ArrayList list = new ArrayList();
foreach ( Mobile m in World.Mobiles.Values )
{
if ( m is BaseCreature )
{
BaseCreature bc = (BaseCreature)m;
if ( bc is CDE )
list.Add( bc );
}
foreach (CDE x in list)
{
x.Delete();
}
}
}
And added
Code:
No_Guard();
to the ondoubleclick method.
Server crash when i doubleclick the item:
Exception:
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext()
at Server.Items.Nogd.No_Guard()
at Server.Items.Nogd.OnDoubleClick(Mobile from)
at Server.Mobile.Use(Item item)
at Server.Engines.XmlSpawner2.XmlAttach.UseReq(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)
Thanks!