--->IM USING LOTF 5017<---
NOTE** THIS IS NOT A RELEASE**<---
After following the

of MaryJuana about how to add top rank in your source i was thinking about to make it more advanced so others can see it and you don't have to use the command every time you relog. Now i've coded alot and after hours of work and i finally had a succesfull build, my char was invisible. Only the chars who had the top rank in my database. Now i'll show some of scripts and tell you in where i add them.
Client.cs under Public void SaveRank()
Code:
public void Savetoprank()
{
LastSave = DateTime.Now;
if (MyClient.There)
if (MyClient.Online)
{
InternalDatabase.SaveChar(this);
InternalDatabase.Savetoprank(this);
}
}
In character.cs below public byte Rank = 0;
Code:
public byte toprank = 0;
In character.cs below public void SaveRank() ... ... ...
Code:
public void Savetoprank()
{
LastSave = DateTime.Now;
if (MyClient.There)
if (MyClient.Online)
{
InternalDatabase.SaveChar(this);
InternalDatabase.Savetoprank(this);
}
}
In Database.cs below Charr.VP = (uint)DR["VP"];
Code:
Charr.toprank = Convert.ToByte((uint)DR["toprank"]);
Also in DatBase.cs below public static void SaveRank(Character Charr) ... ... ...
Code:
public static void Savetoprank(Character Charr)
{
MySqlCommand Command = null;
Command = new MySqlCommand("UPDATE `Characters` SET `toprank` = '" + Charr.toprank + "' WHERE `Account` = '" + Charr.MyClient.Account + "'", ExternalDatabase.Connection);
Command.ExecuteNonQuery();
}
In world.CS below if if (Me.MyGuild != null)
Charr.MyClient.SendPacket(General.MyPackets.GuildN ame(Me.GuildID, Me.MyGuild.GuildName));
Quote:
if (Me.toprank == 1)
Charr.MyClient.SendPacket(General.MyPackets.String (Me.UID, 10, "gamefighter"));
if (Me.toprank == 2)
Charr.MyClient.SendPacket(General.MyPackets.String (Me.UID, 10, "gamewarrior"));
if (Me.toprank == 3)
Charr.MyClient.SendPacket(General.MyPackets.String (Me.UID, 10, "gamebow"));
if (Me.toprank == 4)
Charr.MyClient.SendPacket(General.MyPackets.String (Me.UID, 10, "gamewater"));
if (Me.toprank == 5)
Charr.MyClient.SendPacket(General.MyPackets.String (Me.UID, 10, "gamefire"));
|
In Client.CS below if (MyChar.Rank == 1)... .. ...
Code:
if (MyChar.toprank == 1)
{
SendPacket(General.MyPackets.String(MyChar.UID, 10, "gamefighter"));
}
if (MyChar.toprank == 2)
{
SendPacket(General.MyPackets.String(MyChar.UID, 10, "gamewarrior"));
}
if (MyChar.toprank == 3)
{
SendPacket(General.MyPackets.String(MyChar.UID, 10, "gamebow"));
}
if (MyChar.toprank == 4)
{
SendPacket(General.MyPackets.String(MyChar.UID, 10, "gamewater"));
}
if (MyChar.toprank == 5)
I did added toprank in my database at coproj -> characters.
Also my console give me an error when im logging in using a charr with the
Top Effect.
The console error is
Code:
System.InvalidCastException: Specified cast is not valid.
at COServer_Project.InternalDatabase.GetCharInfo(Character Charr, String UserName) in O:\BasicCO\COServerProject\COServerProject\DataBase.cs:line 261
Q: Why i want to make this system?
A: So i can make NPC giving it. And because its nice