Register for your free account! | Forgot your password?

You last visited: Today at 21:05

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

Advertisement



[REL] ItemLock Saving/Loading

Discussion on [REL] ItemLock Saving/Loading within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Closed Thread
 
Old   #1
 
ImmuneOne's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 754
Received Thanks: 544
[REL] ItemLock Saving/Loading

Since all those people think a code is not complete because I didn't post a save/load method, here it is.

Search for
Code:
                foreach (Game.Item I in C.Inventory)
                    I.WriteThis(BW);
Right click it and click on go to definition.
Then search for
Code:
            I.Write((byte)Color);
Then add underneath it;
Code:
            I.Write(Locked);
Search for;
Code:
                    Color = (ArmorColor)I.ReadByte();
Add underneath it;
Code:
                    Locked = I.ReadInt32();
NOTE: This will only work when you followed my tutorial about implementing.
ImmuneOne is offline  
Thanks
11 Users
Old 03/27/2010, 14:32   #2
 
xScott's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 322
Received Thanks: 63
goodjob, stops everyone crying about your other release not saving/loading ;o
xScott is offline  
Old 03/27/2010, 15:00   #3
 
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
As far as I know this bugs ur character up

EDIT: I wonder what ur gonna release next here's a few ideas were I know url sure get my +Thanks
1. Load/Save accounts + character from MySql
2. The 5200+ Arena button code. xP
Paralyzer[GM] is offline  
Old 03/27/2010, 15:06   #4
 
-Shunsui-'s Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
Quote:
Originally Posted by Paralyzer[GM] View Post
As far as I know this bugs ur character up

EDIT: I wonder what ur gonna release next here's a few ideas were I know url sure get my +Thanks
1. Load/Save accounts + character from MySql
2. The 5200+ Arena button code. xP
>.< Doubt any 1 will release Load/Save Char from MySql, I Can start u off but wount give u the entire code
-Shunsui- is offline  
Old 03/27/2010, 15:13   #5
 
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
I think I could do it provided I knew how to make the mysql use the host/user/pass from like MySqlConnection.css so like say I did a command to make it so that it does Reg into mysql and loads the accounts from MySql it will know the user/pass using the MySqlConnection.cs

Don't worrey I just confused myself

Basicly I want the MySql to use the user/pass in the MySqlConnection.cs
Paralyzer[GM] is offline  
Old 03/27/2010, 15:34   #6
 
-Shunsui-'s Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
Quote:
Originally Posted by Paralyzer[GM] View Post
I think I could do it provided I knew how to make the mysql use the host/user/pass from like MySqlConnection.css so like say I did a command to make it so that it does Reg into mysql and loads the accounts from MySql it will know the user/pass using the MySqlConnection.cs

Don't worrey I just confused myself

Basicly I want the MySql to use the user/pass in the MySqlConnection.cs
why make a new file?

ex this is what i did in database.cs
Code:
 public class Database
    {
        public const string USER_NAME = "root";
        public static string PASSWORD = "";
        public const string SERVER = "";
        public const string DATA_BASE = "";
        static MySqlConnection conn = new MySqlConnection("Server=" + SERVER + ";Database='" + DATA_BASE + "';Username='" + USER_NAME + "';Password='" + PASSWORD + "'");
        static bool did = false;
        public static MySqlConnection Connection
        {
            get
            {
                if (!did)
                { conn.Open(); did = true; conn.StateChange += new System.Data.StateChangeEventHandler(conn_StateChange); }
                return conn;
            }
        }
        static void conn_StateChange(object sender, System.Data.StateChangeEventArgs e)
        {
            if (e.CurrentState == System.Data.ConnectionState.Closed || e.CurrentState == System.Data.ConnectionState.Broken)
            {
                conn.Dispose();
                conn = new MySqlConnection("Server=" + SERVER + ";Database='" + DATA_BASE + "';Username='" + USER_NAME + "';Password='" + PASSWORD + "'");
                conn.Open();
                conn.StateChange += new System.Data.StateChangeEventHandler(conn_StateChange);
            }
        }
-Shunsui- is offline  
Thanks
1 User
Old 03/27/2010, 16:55   #7
 
Luiz01's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 110
Received Thanks: 32
Nice.
Luiz01 is offline  
Old 03/27/2010, 18:15   #8
 
hunterman01's Avatar
 
elite*gold: 20
Join Date: Dec 2006
Posts: 945
Received Thanks: 175
Quote:
Originally Posted by -Shunsui- View Post
why make a new file?

ex this is what i did in database.cs
Code:
 public class Database
    {
        public const string USER_NAME = "root";
        public static string PASSWORD = "";
        public const string SERVER = "";
        public const string DATA_BASE = "";
        static MySqlConnection conn = new MySqlConnection("Server=" + SERVER + ";Database='" + DATA_BASE + "';Username='" + USER_NAME + "';Password='" + PASSWORD + "'");
        static bool did = false;
        public static MySqlConnection Connection
        {
            get
            {
                if (!did)
                { conn.Open(); did = true; conn.StateChange += new System.Data.StateChangeEventHandler(conn_StateChange); }
                return conn;
            }
        }
        static void conn_StateChange(object sender, System.Data.StateChangeEventArgs e)
        {
            if (e.CurrentState == System.Data.ConnectionState.Closed || e.CurrentState == System.Data.ConnectionState.Broken)
            {
                conn.Dispose();
                conn = new MySqlConnection("Server=" + SERVER + ";Database='" + DATA_BASE + "';Username='" + USER_NAME + "';Password='" + PASSWORD + "'");
                conn.Open();
                conn.StateChange += new System.Data.StateChangeEventHandler(conn_StateChange);
            }
        }
Similar to something i did.
hunterman01 is offline  
Old 03/27/2010, 18:16   #9


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
If you guys want to discuss SQL please make a new thread in general.
Korvacs is offline  
Thanks
3 Users
Old 03/27/2010, 19:37   #10
 
elite*gold: 0
Join Date: Mar 2008
Posts: 83
Received Thanks: 10
I add this but now my console dont save items xDD
dextercsar is offline  
Old 03/28/2010, 00:57   #11
 
elite*gold: 0
Join Date: May 2008
Posts: 12
Received Thanks: 0
1st thanks for ur job
2nd i did this and i have erorr in this part

Quote:
Locked = I.ReadInt32();
yes5090 is offline  
Old 03/28/2010, 11:19   #12
 
ImmuneOne's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 754
Received Thanks: 544
Quote:
Originally Posted by yes5090 View Post
1st thanks for ur job
2nd i did this and i have erorr in this part
That's because you didn't change the definition from bool to int yet, which also means you didn't follow my tutorial.

ImmuneOne is offline  
Old 03/28/2010, 14:48   #13
 
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
Create a new character and it won't error...
That's because the binary reader will read beyond the item when trying to get the lock value as it didn't save with the lock...so it will cut 4 bytes which probably belong to the next item...and the next item's id won't be even found in database ... anyway because every item read with 4 bytes more than it should it will give error: Unable to read beyond the stream , or something...and as I said, just create a new character and it will work...Remove other characters ...
-impulse- is offline  
Old 03/28/2010, 19:09   #14
 
elite*gold: 0
Join Date: May 2008
Posts: 12
Received Thanks: 0
Quote:
Originally Posted by ImmuneOne View Post
That's because you didn't change the definition from bool to int yet, which also means you didn't follow my tutorial.

No iam Already followed ur tutorial and i changed the changed the definition from bool to int
yes5090 is offline  
Old 03/28/2010, 21:25   #15
 
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
Seeing as I HATE no I mean it I HATE to say this but....

This save is not his work....
He copied it from his old post that some douchbag made that suxed *****.....
He hasnt tested either


ImmuneOne sorry bro had to say
Paralyzer[GM] is offline  
Closed Thread




All times are GMT +2. The time now is 21:05.


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.