Register for your free account! | Forgot your password?

You last visited: Today at 06:26

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

Advertisement



[Release]Auto Save!!

Discussion on [Release]Auto Save!! within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
felipeboladao's Avatar
 
elite*gold: 0
Join Date: Jul 2007
Posts: 255
Received Thanks: 273
[Release]Auto Save!!

open client.cs search for

Code:
                            if (World.AllChars.Contains(MyChar.UID))
                                World.AllChars.Remove(MyChar.UID);                          
                        }
                        catch (Exception Exc) { General.WriteLine(Exc.ToString()); }
Add below

Code:
                        Console.WriteLine("Account: " + Account + " Character " + MyChar.Name + " has logged off.");
                        World.SaveAllChars();
open General.cs search for

Code:
                GameServer = new ServerSocket();
                GameServer.Port = 5816;
                GameServer.MaxPacketSize = 4096;
                GameServer.MaxThreads = 300;
                GameServer.OnClientDisconnect += new SocketDisconnectEvent(GameDisconnectionHandler);
                GameServer.OnReceivePacket += new SocketEvent(GamePacketHandler);
                GameServer.Enabled = true;

                Console.WriteLine("");
Add below

Code:
                Thetimer = new System.Timers.Timer();
                Thetimer.Interval = 300000;
                Thetimer.Elapsed += new          ElapsedEventHandler(Thetimer_Elapsed);
                Thetimer.Start();
and Search for

Code:
public static void DoStuff()
add under

Code:
        public static void Thetimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            World.SendMsgToAll("Your account has been saved", "SYSTEM", 2005);
            World.SaveAllChars();
        }
Add in timers

Code:
public static System.Timers.Timer Thetimer;
open Word.cs search for

Code:
public static void PlayersOffLottery()
add under

Code:
        public static void SaveAllChars()
        {
            try
            {
                foreach (DictionaryEntry DE in AllChars)
                {
                    Character Charr = (Character)DE.Value;
                    DataBase.SaveChar(Charr);
                }
                Guilds.SaveAllGuilds();
            }
            catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); }
        }
open DataBase.cs search for
public static void GetCharInfo(Character Charr, string UserName)
[/code]

add under

Code:
        public static void SaveChar(Character Charr)
        {
            try
            {
                Charr.PackInventory();
                Charr.PackEquips();
                Charr.PackSkills();
                Charr.PackProfs();
                Charr.PackWarehouses();
                Charr.PackEnemies();
                Charr.PackFriends();

                MySqlCommand Command = null;
                Command = new MySqlCommand("UPDATE `Characters` SET `CharName` = '" + Charr.Name + "', `Level` = " + Charr.Level + ",`Exp` = " + Charr.Exp + ",`GuildDonation` = " + Charr.GuildDonation + ",`Strength` = " + Charr.Str + ",`Agility` = " + Charr.Agi + ",`Vitality` = " + Charr.Vit + ",`Spirit` = " + Charr.Spi + ",`Job` = " + Charr.Job + ",`Model` = " + Charr.Model + ",`Money` = " + Charr.Silvers + ",`CPs` = " + Charr.CPs + ",`CurrentHP` = " + Charr.CurHP + ",`CurrentMP` = " + Charr.CurMP + ",`StatPoints` = " + Charr.StatP + ",`MyGuild` = " + Charr.GuildID + ",`GuildPos` = " + Charr.GuildPosition + ",`LocationMap` = " + Charr.LocMap + ",`LocationX` = " + Charr.LocX + ",`LocationY` = " + Charr.LocY + ",`Hair` = " + Charr.Hair + ",`Equipment` = '" + Charr.PackedEquips + "',`Inventory` = '" + Charr.PackedInventory + "',`PKPoints` = " + Charr.PKPoints + ",`PrevMap` = " + Charr.PrevMap + ", `Skills` = '" + Charr.PackedSkills + "', `Profs` = '" + Charr.PackedProfs + "',`RBCount` = " + Charr.RBCount + ",`Avatar` = " + Charr.Avatar + ",`WHMoney` = " + Charr.WHSilvers + ",`VP` = " + Charr.VP + ",`Warehouses` = '" + Charr.PackedWHs + "',`Friends` = '" + Charr.PackedFriends + "',`dexp` = '" + Charr.dexp + "',`dexptime` = '" + Charr.dexptime + "',`Enemies` = '" + Charr.PackedEnemies + "' WHERE `Account` = '" + Charr.MyClient.Account + "'", DataBase.Connection);
                Command.ExecuteNonQuery();
            }
            catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); }
        }


Work in all Sources..
felipeboladao is offline  
Thanks
3 Users
Old 10/26/2008, 18:30   #2
 
elite*gold: 0
Join Date: Jan 2008
Posts: 145
Received Thanks: 91
A mass save

P.S. My 100th post
pauldexter is offline  
Old 10/26/2008, 18:31   #3
 
elite*gold: 0
Join Date: Feb 2008
Posts: 1,590
Received Thanks: 154
loool.
Waste of memory to save all chars when 1 person loggs off.
This will just overload mysql even more.
tao4229 is offline  
Old 10/26/2008, 18:37   #4
 
elite*gold: 0
Join Date: Jan 2008
Posts: 145
Received Thanks: 91
@tao4229
true
pauldexter is offline  
Old 10/26/2008, 19:24   #5
 
$HaDoW's Avatar
 
elite*gold: 0
Join Date: Sep 2007
Posts: 285
Received Thanks: 78
xDDDDD OMFG !!! DUDE Only last idiot dont know how to do this xD
$HaDoW is offline  
Old 10/26/2008, 20:24   #6
 
Eternal46's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 248
Received Thanks: 11
Shadow you are quite right but an effort is an effort, be a little more nice.
Eternal46 is offline  
Old 10/26/2008, 20:50   #7
 
elite*gold: 0
Join Date: Jul 2005
Posts: 157
Received Thanks: 14
at least he or she is trying to help the community
vietkidd510 is offline  
Old 10/26/2008, 20:55   #8
 
Eternal46's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 248
Received Thanks: 11
Quote:
Originally Posted by vietkidd510 View Post
at least he or she is trying to help the community
Exactly!
Eternal46 is offline  
Old 10/26/2008, 20:56   #9
 
elite*gold: 0
Join Date: Apr 2008
Posts: 470
Received Thanks: 264
added to ;s
XxArcherMasterxX is offline  
Old 10/26/2008, 21:40   #10
 
elite*gold: 20
Join Date: Aug 2005
Posts: 1,734
Received Thanks: 1,000
# Removed Spam - Please try to post things that contribute thread somehow.
tanelipe is offline  
Old 10/26/2008, 22:47   #11
 
taguro's Avatar
 
elite*gold: 0
Join Date: Jun 2007
Posts: 387
Received Thanks: 64
Say what you guys want to, but there is a large possibility for growth here. Someone out there can learn alot from this, as long as they don't intend to leech it completely.
taguro is offline  
Old 10/27/2008, 02:23   #12
 
Tw3ak's Avatar
 
elite*gold: 20
Join Date: Jun 2005
Posts: 1,489
Received Thanks: 301
saving char data only when they log off = data loss if server ever crashes for any reason.
Enless your server is 100% stable ( and i have seen none here that are lol ) this is bad idea and even worse doin it this way saving ALL player data at once everytime some one logs off.

If sql and database class is done properly you can easily save individual players data at timed intervals without any problems what so ever.
Tw3ak is offline  
Old 10/27/2008, 02:37   #13
 
elite*gold: 0
Join Date: Feb 2008
Posts: 1,590
Received Thanks: 154
Quote:
Originally Posted by Tw3ak View Post
saving char data only when they log off = data loss if server ever crashes for any reason.
Enless your server is 100% stable ( and i have seen none here that are lol ) this is bad idea and even worse doin it this way saving ALL player data at once everytime some one logs off.

If sql and database class is done properly you can easily save individual players data at timed intervals without any problems what so ever.
That's what I was saying... It's a waste of CPU, and if you have people constantly logging in/out, it'll also rape the connection.
tao4229 is offline  
Old 10/27/2008, 09:02   #14
 
elite*gold: 0
Join Date: Feb 2008
Posts: 668
Received Thanks: 160
There already is an AutoSave in the LOFT Source...
YukiXian is offline  
Old 10/27/2008, 21:26   #15
 
elite*gold: 0
Join Date: Feb 2008
Posts: 1,590
Received Thanks: 154
Quote:
Originally Posted by YukiXian View Post
There already is an AutoSave in the LOFT Source...
it's LOTF.
tao4229 is offline  
Reply


Similar Threads Similar Threads
[Release]Save Haloes
05/04/2013 - CO2 PServer Guides & Releases - 25 Replies
I made a new easier way of saving halos. I took what Korvacs said into effect. First we're going to define. Lets go to Character.cs and search for:public PKMode PKMode = PKMode.Capture; Atop of that place this public int Top = 0; Now let's go to Database.cs and search for this: public static Game.Character LoadCharacter(string Name, ref string Account) In the bottom of that you will see: C.Spouse =...
Need Auto Save Code for 5165
09/11/2010 - CO2 Private Server - 29 Replies
hi, my source don't save the caracters actions some times ex: i was lvl 120 and i had 2000cps i was in TC , i level up to 200 and i get 5kkcps and i go to BI i relog and i find my character lvl 120 with 2000cps in TC a friend told me you have to make auto save code to save each 2min or 2sec whatever but i don't know what's this code and where i put it
[RELEASE]Great Save!
06/15/2010 - CO2 PServer Guides & Releases - 17 Replies
This is for tanels source :) Is just a autosave. Go to Program.cs. Search for: public static System.Timers.Timer DropEventTimer = null; user it put: public static System.Timers.Timer Thetimer;
new idea but need help (auto save )
05/01/2010 - CO2 Private Server - 20 Replies
i want to make auto save in betaco source but need help :D only i need condition for if or Do...while etc for time of auto save
zoloFighter auto leveling bot ist der save?
03/15/2008 - WoW Bots - 3 Replies
Guten Tag...ich suche nach einem sicheren Bot ...mit dem man auch ein bischen grinding leveln betreiben kann....habe immoment einen 49 er Mage....und habe von zoloFighter auto leveling bot dem bot gehöhrt...ist der noch save? Btw. wenn ich save meine , meine ich nicht detectable von warden...sondern nur über reports banable ;)



All times are GMT +2. The time now is 06:26.


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