[Help]Guild Allies

02/12/2010 02:10 coreymills#1
could someone help me with allies this is what i have so far

Code:
if (MyChar.GuildPosition == 100)
                                {
                                    if (MyChar.MyGuild.Allies.Count <= 6)
                                    {
                                        string Allies = "";
                                        for (int i = 14; i < 14 + Data[13]; i++)
                                        {
                                            Allies += Convert.ToString(Data[i]);
                                        }
                                        uint GuildID = 0;

                                        foreach (DictionaryEntry DE in MyChar.MyGuild.Allies)
                                        {
                                            string ally = (string)DE.Value;
                                            string[] Splitter = ally.Split(':');

                                            if (Splitter[0] == Allies)
                                                GuildID = uint.Parse(Splitter[1]);
                                        }
                                    }
                                    else
                                    {
                                        SendPacket(General.MyPackets.NPCSay("You can only have 6 Allies."));
                                        SendPacket(General.MyPackets.NPCLink("Ok.", 255));
                                        SendPacket(General.MyPackets.NPCSetFace(30));
                                        SendPacket(General.MyPackets.NPCFinish());
                                    }
                                }
                                else
                                {
                                    SendPacket(General.MyPackets.NPCSay("You are not the Guild Leader."));
                                    SendPacket(General.MyPackets.NPCLink("Ok.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
could someone help me with this please
02/12/2010 02:42 kamote#2
Quote:
Originally Posted by coreymills View Post

could someone help me with this please
what exactly is your problem with that code
02/12/2010 02:59 coreymills#3
when i try to add the allies it gives me errors

forgot to mention that the error is in the console and i get the error when i try to add the allie to my guild ingame
02/12/2010 03:58 salem rey#4
hope this will fix :D so that corey will release a guild allies and enemies :D
02/14/2010 11:09 coreymills#5
so i take it no one can help or they just dont want to help
02/14/2010 12:14 Korvacs#6
I think this was mentioned last time but, what exactly is it that you need help with?
02/14/2010 13:04 coreymills#7
when i try to add the allies to my guild ingame i get an error in the console

Quote:
System.InvalidCastException: Specified cast is not valid.
at COServer_Project.Client.GetPacket(Byte[] data) in C:\Documents and Settings\Corey\Desktop\MeteorCo V5017\RandomCo\COServerProject1\COServerProject\Cl ient.cs:line 4064
at COServer_Project.General.GamePacketHandler(Object Sender, HybridSocket Socket) in C:\Documents and Settings\Corey\Desktop\MeteorCo V5017\RandomCo\COServerProject1\COServerProject\Ge neral.cs:line 353
Client.cs Line 4064
Code:
foreach (DictionaryEntry DE in MyChar.MyGuild.Allies)
General.cs Line 353
Code:
Cli.GetPacket(Data);
02/14/2010 13:22 Korvacs#8
Whats this defined as?

Code:
MyChar.MyGuild.Allies
02/14/2010 13:23 coreymills#9
an array
02/14/2010 13:25 Korvacs#10
An array of...?

Well im going to guess string based on what your doing.

DictionaryEntry can only be used with Dictionarys, examples of these are Hashtable() and Dictionary<,>(). What you need is something like this:

Code:
                foreach (string ally in MyChar.MyGuild.Allies)
                {
                    string[] Splitter = ally.Split(':');

                    if (Splitter[0] == Allies)
                        GuildID = uint.Parse(Splitter[1]);
                }
See if that works.