Register for your free account! | Forgot your password?

You last visited: Today at 19:27

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Small Problem...

Discussion on Small Problem... within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
$HaDoW's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 285
Received Thanks: 78
Small Problem...

I'v just changed scource because it has more fixes
but new problem appeared

Code:
System.NullReferenceException: Object reference not set to an instance of an object.
   at COServer_Project.InternalDatabase.GetCharInfo(Character Charr, String UserName)
1.Player cant Login
2.Sometimes Players char is seted to 0 and the char is gone!

how can I fix it ?

Btw
heres the codeline
Code:
public static void GetCharInfo(Character Charr, string UserName)
        {
            MySqlDataAdapter DataAdapter = null;
            DataSet DSet = new DataSet();
            try
            {
                DataAdapter = new MySqlDataAdapter("SELECT * FROM `Characters` WHERE `Account` = '" + UserName + "'", ExternalDatabase.Connection);
                DataAdapter.Fill(DSet, "Character");
                if (DSet != null && DSet.Tables["Character"].Rows.Count > 0)
                {
                    DataRow DR = DSet.Tables["Character"].Rows[0];

                    Charr.UID = (uint)DR["UID"];
                    Charr.Name = (string)DR["CharName"];
                    Charr.Job = Convert.ToByte((uint)DR["Job"]);
                    Charr.Level = Convert.ToByte((uint)DR["Level"]);
                    Charr.Exp = (uint)DR["Exp"];
                    Charr.Model = Convert.ToUInt16((uint)DR["Model"]);
                    Charr.Avatar = Convert.ToUInt16((uint)DR["Avatar"]);
                    Charr.Hair = Convert.ToUInt16((uint)DR["Hair"]);
                    Charr.LocX = Convert.ToUInt16((uint)DR["LocationX"]);
                    Charr.LocY = Convert.ToUInt16((uint)DR["LocationY"]);
                    Charr.LocMap = Convert.ToUInt16((uint)DR["LocationMap"]);
                    Charr.Str = Convert.ToUInt16((uint)DR["Strength"]);
                    Charr.Agi = Convert.ToUInt16((uint)DR["Agility"]);
                    Charr.Vit = Convert.ToUInt16((uint)DR["Vitality"]);
                    Charr.Spi = Convert.ToUInt16((uint)DR["Spirit"]);
                    Charr.Silvers = (uint)DR["Money"];
                    Charr.CPs = (uint)DR["CPs"];
                    Charr.CurHP = Convert.ToUInt16((uint)DR["CurrentHP"]);
                    Charr.PKPoints = Convert.ToUInt16((uint)DR["PKPoints"]);
                    Charr.RBCount = Convert.ToByte((uint)DR["RBCount"]);
                    Charr.PackedInventory = (string)DR["Inventory"];
                    Charr.PackedEquips = (string)DR["Equipment"];
                    Charr.PackedSkills = (string)DR["Skills"];
                    Charr.PackedProfs = (string)DR["Profs"];
                    Charr.WHSilvers = (uint)DR["WHMoney"];
                    Charr.QuestKO = (uint)DR["QuestKO"];
                    Charr.PackedWHs = (string)DR["Warehouses"];
                    Charr.PackedFriends = (string)DR["Friends"];
                    Charr.PackedEnemies = (string)DR["Enemies"];
                    Charr.QuestMob = (string)DR["QuestMob"];
                    Charr.VP = (uint)DR["VP"];
                    Charr.GuildDonation = (uint)DR["GuildDonation"];
                    Charr.StatP = Convert.ToUInt16((uint)DR["StatPoints"]);
                    Charr.GuildID = Convert.ToUInt16((uint)DR["MyGuild"]);
                    Charr.GuildPosition = Convert.ToByte((uint)DR["GuildPos"]);
                    Charr.PrevMap = Convert.ToUInt16((uint)DR["PrevMap"]);
                    if (Guilds.AllGuilds.Contains(Charr.GuildID))
                        Charr.MyGuild = (Guild)Guilds.AllGuilds[Charr.GuildID];
                    Charr.MinAtk = Charr.Str;
                    Charr.MaxAtk = Charr.Str;
                    Charr.Potency = Charr.Level;
                    Charr.RealModel = Charr.Model;
                    Charr.RealAvatar = Charr.Avatar;
                    Charr.MaxHP = Charr.BaseMaxHP();
                    Charr.RealAgi = Charr.Agi;
                }
                else
                    General.WriteLine("Char not found.");
            }
            catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); }
        }
Code:
public static byte Authenticate(string UserName, string Password)
    {
        try
        {
            MySqlDataAdapter DataAdapter = new MySqlDataAdapter("SELECT * FROM `Accounts` WHERE `AccountID` = '" + UserName + "'", Connection);
            DataSet DSet = new DataSet();

            DataAdapter.Fill(DSet, "Account");

            if (DSet == null)
                return 0;
            if (DSet.Tables.Count == 0)
                return 0;
            if (DSet.Tables["Account"].Rows.Count > 0)
            {
                DataRow DR = DSet.Tables["Account"].Rows[0];

                string Pass = (string)DR["Password"];
                if (Pass == Password || Pass == "")
                {
                    if (Pass == "")
                    {
                        if (ExternalDatabase.AllowQuerys)
                            DatabaseQueue.Enqueue(new MySqlCommand("UPDATE `Accounts` SET `Password` = '" + Password + "' WHERE `AccountID` = '" + UserName + "'", Connection));
                    }

                    uint LogonCount = (uint)DR["LogonCount"];
                    LogonCount++;
                    if (ExternalDatabase.AllowQuerys)
                        DatabaseQueue.Enqueue(new MySqlCommand("UPDATE `Accounts` SET `LogonCount` = " + LogonCount + " WHERE `AccountID` = '" + UserName + "'", Connection));

                    return Convert.ToByte((uint)DR["LogonType"]);
                }
                else
                    return 0;
            }
            else
                return 0;
        }
        catch (Exception Exc) { Console.WriteLine(Exc.ToString()); return 0; }
    }
Plz Help
$HaDoW is offline  
Old 10/10/2008, 01:51   #2
 
elite*gold: 0
Join Date: Feb 2008
Posts: 1,590
Received Thanks: 154
The problem isn't WITH the CharacterInfo... It's just getting errors in CharacterInfo because the server can't read the values.
tao4229 is offline  
Reply


Similar Threads Similar Threads
Small Problem
08/28/2008 - Silkroad Online - 1 Replies
I've got problem...When I'm trying to run silkroad I'm getting communicate that the srver is undergoin inspection or updates...That's strange because I don't see any info on silkroadonline.net that the server is off today... I've downloaded and installed SRO normally without patching any media pk2 or trying to run client with bot...
Another small problem
05/10/2008 - SRO Private Server - 3 Replies
Through 1000, I downloaded all from 1-2 hours, but now that I want to create an account, and go even on the official site I can not create the account as saying that there is an error in the e-mail, someone would know ? Or could give me some accounts superfluous? XD To write I use Google XD :p
Small Problem But ..
05/08/2007 - Silkroad Online - 4 Replies
Hey .. After Silkroad Done updating I got Problem with Bot .. When i press start its Get to Lag when Loading to enter the Game
Small Problem.
04/02/2006 - Conquer Online 2 - 2 Replies
I recently downloaded CO because my old compy had died. I installed and it is only a icon on my desktop (Double click it and CO screen comes up). It isn't a file. I used macros all the time but don't think it is possible like this. Can anyone tell me wth is wrong with my conquer so I can use macroz again? Thanks. :cry:
SOME small PROBLEM
02/24/2006 - Conquer Online 2 - 3 Replies
Im using CoPanther and..well it seams to work find..but when i set "pick all" then...it sometimes close my client...and i wonder why. Other problem is..when i set f.x. "pick all" CoPnather doesn't pick those items! And its not even trying! Same with "picking selected" so it should pick DBs,mets, and items i put in those blank places...but again... i set to picl "Gold" and... heh it doesnt try even to pick gold..and what is more... same with meteor..so WHY THE FUCK IT ISNT WORKING!



All times are GMT +1. The time now is 19:27.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.