Alright man, we've helped you enough, its time for you to take the pieces and put them together and try and give it a go on your own. We're not gonna spoonfeed you mate.
foreach (Features.Guild g in Features.Guilds.AllTheGuilds.Values)
{
if (g.GuildName == Ally)
{
is making a foreach loop and checking all the guilds.
then it checks for a guild with the name that u putted as ally.
string Ally = ReadString(Data); will read from Link2 and make it to the string ally.
So basicly g.GuildName == Ally is just checking what u wrote.
And this will only add them as allie to ur self, he have to do it also.
Just like normal. (Don't know why u aint running a team check instead).
To check if only 2 guildleaders in team and then if u both click.
Much easier and better
i have debug it and indeed he is doing that good, but if he is coming by the:
Code:
if (g.Creator.Info.MyTeam.Members.Contains(GC.MyChar.EntityID))
then i check the members in debug and i have the 2 leaders in the team, and the EntityID's are correct, but he is see it as IF NOT state and skip the part to make it ally.
really strange, what i do nothing is working, you have any idea?
Quote:
Originally Posted by 1337 H4X0R
foreach (Features.Guild g in Features.Guilds.AllTheGuilds.Values)
{
if (g.GuildName == Ally)
{
is making a foreach loop and checking all the guilds.
then it checks for a guild with the name that u putted as ally.
string Ally = ReadString(Data); will read from Link2 and make it to the string ally.
So basicly g.GuildName == Ally is just checking what u wrote.
And this will only add them as allie to ur self, he have to do it also.
Just like normal. (Don't know why u aint running a team check instead).
To check if only 2 guildleaders in team and then if u both click.
Much easier and better
GC.MyChar .. the tittle tells you...
foreach is missing guyz,,
Code:
foreach (Game.Character Target in World.H_Chars.Values)
{
if (GC.MyChar != Target)
{
[spoiler]The code for team and etc.. put almost everything inside this foreach (you should know what you need to)[/spoiler]
}
}
>.> I knew I should have just waited instead of attempting it myself in the first place lmao. This is what happens when you try to add it from another source then try and add it the correct way lol. I think Arcos code will work fine BUT I get this error.
Yup and the thing is it shouldn`t even be there lol. I can`t remember what I did and didn`t add from back then >.< Problem is if I take that part out then it comes up with errors.
Ok got past that hurdle but now I come across this part lol
Nevermind I got it working
Next problem is with deleting Guilds.dat >.< It is giving me errors all over the place So I have a folder in OldCODB "Guilds" and I have a Guilds.dat in there BUT I also have a Guilds.dat in the OldCODB as well?
NewestCOServer crashes also and when my char logs on there are no NPCs and my char is naked BUT he still has the topguildleader thing and professor and king >.<
Had another attempt and so far everything seems fine.
Ok WTF?!?!?!?! I try to add it to the guild NPC but it does nothing when I click add allies/enemies, however if I create a seperate NPC the friggin thing works o.0?
I will give code for my NPC and for guild NPC so why does it work for one but not the other o.0????
Code:
#region Guild NPC allied&enemied
case 19999:
{
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("I am what my name says. I create and manage guilds. So what do you want to do?"));
GC.AddSend(Packets.NPCLink("Create Allies", 1));
GC.AddSend(Packets.NPCLink("Create Enemies", 3));
GC.AddSend(Packets.NPCLink("Just passing by.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
#region Ally
if (Control == 1)
{
GC.AddSend(Packets.NPCSay("Who would you like to Ally?"));
GC.AddSend(Packets.NPCLink2("Ally", 21));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
if (Control == 21)
{
if (GC.MyChar.MyGuild != null && GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
string Ally = ReadString(Data);
foreach (Features.Guild g in Features.Guilds.AllTheGuilds.Values)
{
if (g.GuildName == Ally)
{
if (g.Creator.Info != null)
{
if (g.Creator.Info.MyTeam.Members.Contains(GC.MyChar.EntityID))
{
if (!GC.MyChar.MyGuild.Allies.ContainsValue(Ally))
{
GC.MyChar.MyGuild.Allies.Add(0, Ally);
GC.AddSend(Packets.String(g.GuildID, 21, Ally));
GC.AddSend(Packets.NPCSay(g.GuildName + " is now your ally!"));
GC.AddSend(Packets.NPCLink("Thanks.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay(g.GuildName + " is already allied."));
GC.AddSend(Packets.NPCLink("Oh alright.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else
{
GC.AddSend(Packets.NPCSay("Make sure the guild leader of the Features guild is in your team."));
GC.AddSend(Packets.NPCLink("Okay", 255));
}
}
}
}
break;
}
}
#endregion
#region Enemy
if (Control == 3)
{
GC.AddSend(Packets.NPCSay("Who would you like to Enemy?"));
GC.AddSend(Packets.NPCLink2("Enemy", 23));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
if (Control == 23)
{
if (GC.MyChar.MyGuild != null && GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
string Enemy = ReadString(Data);
foreach (Features.Guild g in Features.Guilds.AllTheGuilds.Values)
{
if (g.GuildName == Enemy)
{
if (g.Creator.Info != null)
{
if (!GC.MyChar.MyGuild.Enemies.ContainsValue(Enemy))
{
GC.MyChar.MyGuild.Enemies.Add(0, Enemy);
GC.AddSend(Packets.String(g.GuildID, 21, Enemy));
GC.AddSend(Packets.NPCSay(g.GuildName + " is now your enemy!"));
GC.AddSend(Packets.NPCLink("Thanks.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay(g.GuildName + " is already enemied."));
GC.AddSend(Packets.NPCLink("Oh alright.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else
{
GC.AddSend(Packets.NPCSay("Make sure the guild leader of the Features guild is in your team."));
GC.AddSend(Packets.NPCLink("Okay", 255));
}
}
}
}
break;
}
#endregion
break;
}
#endregion
Code:
#region Guild NPC
case 10003:
{
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("I am what my name says. I create and manage guilds. So what do you want to do?"));
GC.AddSend(Packets.NPCLink("Create Guild", 1));
GC.AddSend(Packets.NPCLink("Deputize", 3));
GC.AddSend(Packets.NPCLink("Disband my guild", 5));
GC.AddSend(Packets.NPCLink("Allies", 7));
GC.AddSend(Packets.NPCLink("Enemies", 9));
GC.AddSend(Packets.NPCLink("Just passing by.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
#region Create
else if (Control == 1)
{
if (GC.MyChar.MyGuild == null)
{
GC.AddSend(Packets.NPCSay("I don't know why, but you have to be level 95 or higher and need 1 million silvers to create one."));
GC.AddSend(Packets.NPCLink2("Create", 2));
GC.AddSend(Packets.NPCLink("No, i changed my mind.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay("You are already in a guild. You cannot create a guild."));
GC.AddSend(Packets.NPCLink("Oh, i forgot...", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else if (Control == 2)
{
if (GC.MyChar.Level >= 95 && GC.MyChar.MyGuild == null)
{
if (GC.MyChar.Silvers >= 1000000)
{
string GuildName = ReadString(Data);
if (Features.Guilds.ValidName(GuildName))
{
GC.MyChar.Silvers -= 1000000;
ushort NewGuildID = (ushort)Rnd.Next(ushort.MaxValue);
while (Features.Guilds.AllTheGuilds.Contains(NewGuildID))
NewGuildID = (ushort)Rnd.Next(ushort.MaxValue);
Features.Guilds.CreateNewGuild(GuildName, NewGuildID, GC.MyChar);
Game.World.Spawn(GC.MyChar, false);
GC.AddSend(Packets.GuildInfo(GC.MyChar.MyGuild, GC.MyChar));
GC.AddSend(Packets.String(GC.MyChar.MyGuild.GuildID, (byte)Game.StringType.GuildName, GC.MyChar.MyGuild.GuildName));
GC.AddSend(Packets.NPCSay("Congratulations! You now have your own guild."));
GC.AddSend(Packets.NPCLink("Thanks.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay("Choose another name, this name is taken or has invalid length."));
GC.AddSend(Packets.NPCLink2("Create", 2));
GC.AddSend(Packets.NPCLink("I changed my mind.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else
{
GC.AddSend(Packets.NPCSay("I said you need 1 million silvers and you don't have enough."));
GC.AddSend(Packets.NPCLink("Ok ok, i'll go bring the money.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else
{
GC.AddSend(Packets.NPCSay("Forget it! You're too weak."));
GC.AddSend(Packets.NPCLink("Alright, i will get stronger.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
#endregion
#region Deputize
else if (Control == 3)
{
if (GC.MyChar.MyGuild != null && GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
GC.AddSend(Packets.NPCSay("Insert the name of the player in your guild you want to make a deputy leader."));
GC.AddSend(Packets.NPCLink2("Here", 4));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay("You are not a guild leader."));
GC.AddSend(Packets.NPCLink("Silly me.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else if (Control == 4)
{
string PlayerName = ReadString(Data);
Features.MemberInfo M = GC.MyChar.MyGuild.MembOfName(PlayerName);
if (M != null && M.MembName == PlayerName && ((Hashtable)GC.MyChar.MyGuild.Members[(byte)90]).Count < 5)
{
M.Rank = NewestCOServer.Features.GuildRank.DeputyManager;
((Hashtable)GC.MyChar.MyGuild.Members[(byte)50]).Remove(M.MembID);
((Hashtable)GC.MyChar.MyGuild.Members[(byte)90]).Add(M.MembID, M);
Game.Character C = M.Info;
if (C != null)
{
C.GuildRank = NewestCOServer.Features.GuildRank.DeputyManager;
Game.World.Spawn(C, false);
C.MyClient.AddSend(Packets.GuildInfo(GC.MyChar.MyGuild, GC.MyChar));
}
}
else
{
GC.AddSend(Packets.NPCSay("The player is not in your guild or is not a normal member. By the way, the max number deputy leaders there can be is 5."));
GC.AddSend(Packets.NPCLink("Oh, sorry.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
#endregion
#region Disband
else if (Control == 5)
{
if (GC.MyChar.MyGuild != null && GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
GC.AddSend(Packets.NPCSay("Are you sure you want to disband your guild?"));
GC.AddSend(Packets.NPCLink("Yes, i want to disband my guild.", 6));
GC.AddSend(Packets.NPCLink("I've changed my mind.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay("You are not a guild leader, therefore you cannot disband a guild."));
GC.AddSend(Packets.NPCLink("I see.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else if (Control == 6)
{
if (GC.MyChar.MyGuild != null && GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
GC.MyChar.MyGuild.Disband();
}
#endregion
#region Ally
if (Control == 7)
{
GC.AddSend(Packets.NPCSay("Who would you like to Ally?"));
GC.AddSend(Packets.NPCLink2("Ally", 21));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else if (Control == 21)
{
if (GC.MyChar.MyGuild != null && GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
string Ally = ReadString(Data);
foreach (Features.Guild g in Features.Guilds.AllTheGuilds.Values)
{
if (g.GuildName == Ally)
{
if (g.Creator.Info != null)
{
if (g.Creator.Info.MyTeam.Members.Contains(GC.MyChar.EntityID))
{
if (!GC.MyChar.MyGuild.Allies.ContainsValue(Ally))
{
GC.MyChar.MyGuild.Allies.Add(0, Ally);
GC.AddSend(Packets.String(g.GuildID, 21, Ally));
GC.AddSend(Packets.NPCSay(g.GuildName + " is now your ally!"));
GC.AddSend(Packets.NPCLink("Thanks.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay(g.GuildName + " is already allied."));
GC.AddSend(Packets.NPCLink("Oh alright.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else
{
GC.AddSend(Packets.NPCSay("Make sure the guild leader of the Features guild is in your team."));
GC.AddSend(Packets.NPCLink("Okay", 255));
}
}
}
}
break;
}
}
#endregion
#region Enemy
if (Control == 9)
{
GC.AddSend(Packets.NPCSay("Who would you like to Enemy?"));
GC.AddSend(Packets.NPCLink2("Enemy", 23));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else if (Control == 23)
{
if (GC.MyChar.MyGuild != null && GC.MyChar.GuildRank == NewestCOServer.Features.GuildRank.GuildLeader)
{
string Enemy = ReadString(Data);
foreach (Features.Guild g in Features.Guilds.AllTheGuilds.Values)
{
if (g.GuildName == Enemy)
{
if (g.Creator.Info != null)
{
if (!GC.MyChar.MyGuild.Enemies.ContainsValue(Enemy))
{
GC.MyChar.MyGuild.Enemies.Add(0, Enemy);
GC.AddSend(Packets.String(g.GuildID, 23, Enemy));
GC.AddSend(Packets.NPCSay(g.GuildName + " is now your enemy!"));
GC.AddSend(Packets.NPCLink("Thanks.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay(g.GuildName + " is already enemied."));
GC.AddSend(Packets.NPCLink("Oh alright.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
else
{
GC.AddSend(Packets.NPCSay("Make sure the guild leader of the Features guild is in your team."));
GC.AddSend(Packets.NPCLink("Okay", 255));
}
}
}
}
break;
}
#endregion
}
break;
}
#endregion
[Problem]Guild Allies and Enemies 08/16/2010 - CO2 Private Server - 2 Replies Well after two days of having a go at this, and one day of asking people for help, I finally decided it was time to ask the community for help.
Well I am trying to load allies from the Guilds.dat file.
They are defined as public Dictionary<uint, string> Allies = new Dictionary<uint, string>();
When something is added to the dictionary its like this.
Allies.Add(GuildID, GuildName);
Now when saving to the guild.dat file, its saved like this.
BW.Write((int)Allies.Count);
...
allies and enemies 03/31/2010 - CO2 Private Server - 1 Replies Anybody know if Guild Allie and Enemy code is released for LOTF?
The status are added, but not codes for npc.
And im to lazy to make it, so if is not released ill just leave it untill i got time to make it ^^
Thanks
[Help]Guild Allies 02/14/2010 - CO2 Private Server - 9 Replies could someone help me with allies this is what i have so far
if (MyChar.GuildPosition == 100)
{
if (MyChar.MyGuild.Allies.Count <= 6)
{
string Allies = "";
for (int i = 14; i < 14 + Data; i++)
{
Allies +=...
[Question]Guild Allies 02/02/2010 - CO2 Private Server - 0 Replies could someone help me with adding allies
its for 5017
guild and allies 12/29/2007 - CO2 Weapon, Armor, Effects & Interface edits - 0 Replies hi all
i was thinking
does anyone know if its possible to make allie colors yellow and guild green
cause i like the green more
grtz