Register for your free account! | Forgot your password?

You last visited: Today at 13:27

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

Advertisement



[Release] one stability problem fixed

Discussion on [Release] one stability problem fixed within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2007
Posts: 306
Received Thanks: 75
[Release] one stability problem fixed

For those of you who have been on my server recently and have noticed your level isn't what it was the day before, there was a problem in my SaveChar.. I was overloading mysql by saving so many strings that long..

here's the remedy! (if you start adding variables to the character database for saving)

in your catch(blah blah) {} clause in savechar replace it with:

Code:
catch (Exception Exc) { 
                General.WriteLine(Convert.ToString(Exc));
                Connection.Close();
                Connect("USER", "PASS");
                if (World.SaveAllChars())
                    General.WriteLine("Connection to mysql server reinitiated");
                else
                    General.WriteLine("Connection Error, server restarting! " + DateTime.Now());
            }
Next, split the string into multiple strings!
(Update Characters Set 'var' = 'value', 'var2' = 'value2', ETC) try to keep it under 10 vars per string for extra saftey!

and Finally, goto public static void SaveAllChars() { in world, and replace it with this:

Code:
        public static bool SaveAllChars()
        {
            try
            {
                foreach (DictionaryEntry DE in AllChars)
                {
                    Character Charr = (Character)DE.Value;
                    DataBase.SaveChar(Charr);
                }
                Guilds.SaveAllGuilds();
                return true;
            }
            catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); return false; }
        }

and that will prevent your Connection() from dying and you losing hard-earned character data!
Rechocto is offline  
Thanks
4 Users
Old 09/19/2008, 12:52   #2
 
elite*gold: 0
Join Date: Aug 2006
Posts: 227
Received Thanks: 57
I love you Bro
Error: Use DateTime.Now instead of DateTime.Now() <-- didnt work at me
keving is offline  
Old 09/19/2008, 15:52   #3
 
pegaeu's Avatar
 
elite*gold: 0
Join Date: Mar 2008
Posts: 62
Received Thanks: 6
where I put,
catch (Exception Exc) {
General.WriteLine(Convert.ToString(Exc));
Connection.Close();
Connect("rech", "prohh");
if (World.SaveAllChars())
General.WriteLine("Connection to mysql server reinitiated");
else
General.WriteLine("Connection Error, server restarting! " + DateTime.Now());
}
help me plz
i'm using powersourceCO
pegaeu is offline  
Old 09/19/2008, 17:21   #4
 
elite*gold: 0
Join Date: Aug 2006
Posts: 227
Received Thanks: 57
Quote:
Originally Posted by pegaeu View Post
where I put,
catch (Exception Exc) {
General.WriteLine(Convert.ToString(Exc));
Connection.Close();
Connect("rech", "prohh");
if (World.SaveAllChars())
General.WriteLine("Connection to mysql server reinitiated");
else
General.WriteLine("Connection Error, server restarting! " + DateTime.Now());
}
help me plz
i'm using powersourceCO
At SaveChar
keving is offline  
Thanks
1 User
Old 09/19/2008, 17:38   #5
 
pegaeu's Avatar
 
elite*gold: 0
Join Date: Mar 2008
Posts: 62
Received Thanks: 6
i got 1 error with "Now"
'System.DateTime' does not contain for now..
pegaeu is offline  
Old 09/19/2008, 21:08   #6
 
elite*gold: 0
Join Date: Nov 2007
Posts: 306
Received Thanks: 75
SORRY lol. I sort of retyped it in this window.. be sure to change "rech" to your mysql user, and "prohh" to your pass (this is my limited user on mysql haha, don't worry I already changed the user and pass realizing I typed it in here), as for DateTime.Now... I would change that from
Code:
else
General.WriteLine("Connection Error, server restarting! " + DateTime.Now());
to
Code:
                else
                {
                    General.WriteLine("{0:F} > Connection Error, server restarting!", DateTime.Now);
                    General.ServerRestart();
                }
Rechocto is offline  
Old 09/20/2008, 00:40   #7
 
pegaeu's Avatar
 
elite*gold: 0
Join Date: Mar 2008
Posts: 62
Received Thanks: 6
now i got error:
General.WriteLine("{0:F} > Connection Error, server restarting!", DateTime.Now);
"No overload for the method 'WriteLine' takes '2' arguments"
help me please,
pegaeu is offline  
Old 09/20/2008, 01:56   #8
 
elite*gold: 0
Join Date: Nov 2007
Posts: 306
Received Thanks: 75
your general.writeline must be different than mine then , use:

Code:
string log = ("{0:F} > Connection Error, server restarting!", DateTime.Now);

public static System.IO.StreamWriter sw = new System.IO.StreamWriter(Application.StartupPath + @"\ServerLog.txt", true);

Console.WriteLine("Connection Error, server restarting!");
sw.WriteLine(log);
if that bugs, try to fix it yourself, I didn't test it, I put it in here

just put that where your General.WriteLine line is after the else { and before the General.ServerRestart()
Rechocto is offline  
Old 09/20/2008, 03:38   #9
 
elite*gold: 0
Join Date: Jan 2008
Posts: 145
Received Thanks: 91
Quote:
Next, split the string into multiple strings!
(Update Characters Set 'var' = 'value', 'var2' = 'value2', ETC) try to keep it under 10 vars per string for extra saftey!
who can explain this?
i don't understand.
pauldexter is offline  
Old 09/20/2008, 03:42   #10
 
elite*gold: 0
Join Date: Nov 2007
Posts: 306
Received Thanks: 75
Quote:
Originally Posted by pauldexter View Post
who can explain this?
i don't understand.
say you have like

MysqlCommand cmd = new MysqlCommand("update characters set 'charname' = '" + Charr.Name + "', 'LocX' = '" + Char.LocX + "' where 'Account' = '" + Charr.AccountName + "'");
cmd.ExecuteNonQuery();

and you want it split up into 2, change it to

MysqlCommand cmd = new MysqlCommand("update characters set 'charname' = '" + Charr.Name + "' where 'Account' = '" + Charr.AccountName + "'");
MysqlCommand cmd2 = new MysqlCommand("update characters set 'LocX' = '" + Char.LocX + "' where 'Account' = '" + Charr.AccountName + "'");
cmd.ExecuteNonQuery(); cmd2.ExecuteNonQuery();
Rechocto is offline  
Old 09/20/2008, 03:45   #11
 
InfamousNoone's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
The MySQL C# Adapter has something nifty call a threadpool, thanks for your release; you just made it a lot easier for me to rape LOTF-based servers using this.
InfamousNoone is offline  
Old 09/20/2008, 03:55   #12
 
elite*gold: 0
Join Date: Jan 2008
Posts: 145
Received Thanks: 91
i got it thanks!

btw is it ok to use this? with { and }
Code:
                if (World.SaveAllChars())
                {
                    General.WriteLine("Connection to mysql server reinitiated");
                }
                else
                {
                    General.WriteLine("Connection Error, server restarting! " + DateTime.Now);
                    General.ServerRestart();
                }
pauldexter is offline  
Old 09/20/2008, 04:23   #13
 
elite*gold: 0
Join Date: Nov 2007
Posts: 306
Received Thanks: 75
lol! yah I though of that too :P just sendany packet for a command that uses the database about 50 times in a second (WPE PRO?) and the server shouldn't save anything anymore unless they have a reconnect script.. also I'm working on an auto-drop() and ban script for when people try to do that to my server
Rechocto is offline  
Old 09/20/2008, 04:29   #14
 
elite*gold: 0
Join Date: Jan 2008
Posts: 145
Received Thanks: 91
can you tell me whats the diff between the two?
the update with ' and without '


"UPDATE `Characters` SET `something` = '" + Charr.something + "' WHERE `Account` = '" + Charr.MyClient.Account + "'", Connection);

and

"UPDATE `Characters` SET `something` = " + Charr.something + " WHERE `Account` = '" + Charr.MyClient.Account + "'", Connection);

-------------------------------------------
my savechar is to long after i split all, can it cause high memory usage?
pauldexter is offline  
Old 09/20/2008, 04:42   #15
 
elite*gold: 0
Join Date: Nov 2007
Posts: 306
Received Thanks: 75
needs '' to be saved as a string otherwise it tries to reference Charr.something's value as another column in the table..

say you have:

+------+---+
|randval|str|
+------+---+
|joe |38 |
+------+---+

and you say
update tbl set randval=str

it will do
+------+--+
|randval|str|
+------+---+
|38 |38 |
+------+---+

but
update tbl set randval='str'

will do:

+-------+-+
|randval|str|
+------+---+
|str |38 |
+------+---+

make sense?
Rechocto is offline  
Reply


Similar Threads Similar Threads
Best server atm ? (stability ,rates ,got people ,etc)
09/02/2010 - Aion Private Server - 6 Replies
ok so i am dling aion atm ,and found alot of servers ,so was wondering whats the best server atm ,having most stuff done and skills ,classes ,etc is most important ,2nd stability ,3rd actually got people playing not just 11 .. ,4th if available a high rates one ,thanks in advance ^^ . oh english server btw .
Mass Spawn Stability
03/30/2010 - Dekaron - 18 Replies
Lately, Ive been getting disconnected a lot while using Mass Spawn. For example, when I do Oread, I use drako's all in one vac script with mobs speed set at 1, zoom, fareye, autopots, wall and speed, but no matter what I do, I get disconnected after killing spawns for around a minute to five or ten minutes. I dont think graphics lag is what is causing me to get disconnected, cause I got an i5 750 processor and a ATI 5770 graphic card, which is overkill for 2moons. Am I missing...
Increase Gatherbuddys stability
12/04/2009 - WoW Bots - 2 Replies
Hello together, since Gatherbuddy is out i can count myself to a member who use it nearly every day for 12 hours. But i had a time where i got a lot of WoW Errors 132. Just a few days ago i found a way how to avoid these annoying errors. Its so simple .. you just have to run WoW on one core instead of 2 or 4 or whatever. I dont know why it works but its confirmed by me (Gatherbuddy now runs 9 days without a wow error. Before wow crashed everytime i use an bot which inject) But after...
Dekaron/CE stability -dc
10/20/2009 - Dekaron - 10 Replies
Hi people! There is something what bothers me and that is damn disconnect while farming.. I wonder how stable is your game whitout disc! 5min, 10min , hour ?? At first i tho there is problem whit offsets, but then some ppl gave me their script and guess what ,problem still stays.. Could it be bypass? I mean that would explain alot, thats why i ask how long u can play whitout disconnect. Ofcourse im using ReXIGNation v1.1, so thats not a question..Now im done some tests whit CT.. Im...
[RELEASE]Updated Snootae Potter 1.1 *Fixed stopping problem*
03/05/2008 - MapleStory - 0 Replies
Snootae Potter 1.1 decided to post it since it's not here yet Thank snootae. Snootae's pixel-based potter for MapleStory http://img301.imageshack.us/img301/6040/asfasfsdgs ghddd0.png Made By Snootae or AdamG62



All times are GMT +1. The time now is 13:28.


Powered by vBulletin®
Copyright ©2000 - 2025, 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 ©2025 elitepvpers All Rights Reserved.