Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 05:41

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

Advertisement



[QUESTION] Make this load in ini

Discussion on [QUESTION] Make this load in ini within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 20
Join Date: May 2008
Posts: 1,103
Received Thanks: 254
[QUESTION] Make this load in ini

Well im trying to make my Portals load ini from my debug can someoen help me with this?


public static void LoadPortals()
{
MySqlCommand Command = new MySqlCommand("SELECT * FROM `portals`;", Connection);
MySqlDataAdapter Adapter = new MySqlDataAdapter(Command);
DataSet DS = new DataSet("Count");
Adapter.Fill(DS, "Count");
if (DS.Tables["Count"].Rows.Count > 0)
{
int Portal = DS.Tables["Count"].Rows.Count;

Portals = new ushort[Portal][];
for (int i = 0; i < DS.Tables["Count"].Rows.Count; i++)
{
DataRow Data = DS.Tables["Count"].Rows[i];
Portals[i] = new ushort[6] { Convert.ToUInt16((uint)Data["FromMap"]), Convert.ToUInt16((uint)Data["FromX"]), Convert.ToUInt16((uint)Data["FromY"]), Convert.ToUInt16((uint)Data["NewMap"]), Convert.ToUInt16((uint)Data["NewX"]), Convert.ToUInt16((uint)Data["NewY"]) };
}
}
}
Pete1990 is offline  
Old 05/25/2009, 01:56   #2
 
justprownage's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 203
Received Thanks: 87
Check Infamous' source. It shows you exactly how.
justprownage is offline  
Old 05/25/2009, 02:34   #3
 
elite*gold: 20
Join Date: May 2008
Posts: 1,103
Received Thanks: 254
ok i tried that but its not wokring becuse id ont have those files and if i try and add them boom crashes and btw this is lotf source im useing.
public static void LoadPortals()
{
string LoadPortals= System.IO.File.ReadAllText(System.Windows.Forms.Ap plication.StartupPath + @"\Portals.ini");
DataSet DS = new DataSet("Count");
Ini.Fill(DS, "Count");
if (DS.Tables["Count"].Rows.Count > 0)
{
int Portal = DS.Tables["Count"].Rows.Count;

Portals = new ushort[Portal][];
for (int i = 0; i < DS.Tables["Count"].Rows.Count; i++)
{
DataRow Data = DS.Tables["Count"].Rows[i];
Portals[i] = new ushort[6] { Convert.ToUInt16((uint)Data["FromMap"]), Convert.ToUInt16((uint)Data["FromX"]), Convert.ToUInt16((uint)Data["FromY"]), Convert.ToUInt16((uint)Data["NewMap"]), Convert.ToUInt16((uint)Data["NewX"]), Convert.ToUInt16((uint)Data["NewY"]) };
}
}
}
Pete1990 is offline  
Old 05/25/2009, 02:36   #4
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
change string BannedIP to string Portals
PeTe Ninja is offline  
Old 05/25/2009, 02:38   #5
 
elite*gold: 20
Join Date: May 2008
Posts: 1,103
Received Thanks: 254
Yea i seent hat still dont work lol
Pete1990 is offline  
Old 05/25/2009, 02:47   #6
 
justprownage's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 203
Received Thanks: 87
It's supposed to write the string. You still have this whole part:
Code:
DataSet DS = new DataSet("Count");
Ini.Fill(DS, "Count");
if (DS.Tables["Count"].Rows.Count > 0)
{
int Portal = DS.Tables["Count"].Rows.Count;

Portals = new ushort[Portal][];
for (int i = 0; i < DS.Tables["Count"].Rows.Count; i++)
{
DataRow Data = DS.Tables["Count"].Rows[i];
Portals[i] = new ushort[6] { Convert.ToUInt16((uint)Data["FromMap"]), Convert.ToUInt16((uint)Data["FromX"]), Convert.ToUInt16((uint)Data["FromY"]), Convert.ToUInt16((uint)Data["NewMap"]), Convert.ToUInt16((uint)Data["NewX"]), Convert.ToUInt16((uint)Data["NewY"]) };
This code interacts with the SQL database. You need to re-code this.
justprownage is offline  
Old 05/25/2009, 02:50   #7
 
elite*gold: 20
Join Date: May 2008
Posts: 1,103
Received Thanks: 254
:O just forget it i dont knwo how to do that lmao.
Pete1990 is offline  
Old 05/25/2009, 04:00   #8


 
CptSky's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 1,444
Received Thanks: 1,176
Code:
        public static void LoadPortals()
        {
            try
            {
                int PortalsC = 0;

                string[] PortalsInfo = File.ReadAllLines(Application.StartupPath + @"\Portals.txt");

                Portals = new ushort[PortalsInfo.Length][];

                for (int i = 0; i < PortalsInfo.Length; i++)
                {
                    string[] Splitter = PortalsInfo[i].Split(' ');

                    //FromMap, FromX, FromY, ToMap, ToX, ToY
                    Portals[i] = new ushort[6] { ushort.Parse(Splitter[0]), ushort.Parse(Splitter[1]), ushort.Parse(Splitter[2]), ushort.Parse(Splitter[3]), ushort.Parse(Splitter[4]), ushort.Parse(Splitter[5]) };
                    PortalsC++;
                }
                General.WriteLine("Loaded " + PortalsC + " portals.");
            }
            catch (Exception Exc) { General.WriteLine(Exc.ToString()); }
        }
CptSky is offline  
Thanks
3 Users
Old 05/25/2009, 04:42   #9
 
elite*gold: 20
Join Date: May 2008
Posts: 1,103
Received Thanks: 254
Thank you so much this might be pushing it but do u have the portal.txt u can post
Pete1990 is offline  
Old 05/25/2009, 14:24   #10
 
IcedEarth's Avatar
 
elite*gold: 0
Join Date: Mar 2007
Posts: 146
Received Thanks: 17
Here Pete.
Attached Files
File Type: txt Portals.txt (7.8 KB, 10 views)
IcedEarth is offline  
Reply


Similar Threads Similar Threads
[Question] Log in/Load Npc
05/08/2010 - CO2 Private Server - 8 Replies
Hej all, If i restarted server, and i log in.. i have to move around map(around 2 jumps) before it shows my Npc's/guards/mobs etc... Any 1 know this problem and the fix :).. Gratz! ++ If i am in FrozenGrooto(7001), and i restart/dc server...
[Question]Is it possbile to make 5165 load accs, ranks, characters From mysql ?
03/14/2010 - CO2 Private Server - 40 Replies
Well I have been wondering this for a long but but I relise you need another .cs file I dono call it Connect.cs and ur gonna want the tables Characters, Accounts, Top archer, Top ko, Top Donations etc But how would you do this ? change the method from biniary to save ? idk just asking for some help with this and I may try to do this.
Question About iSRO bot and Load
11/08/2008 - Silkroad Online - 4 Replies
Okay, so what I am trying to do is, make it so I can run iSRO bot with a No-DC loader. Getting on greece is a pain. 24\7 Traffic. Any way i can accomplish this? ~THANKS~ irnoobloer
How make CoHook load automatcally with conquer!!
02/06/2008 - CO2 Guides & Templates - 0 Replies
Hello, i find a way to make cohook load automatcally with conquer , here is the guide : 1. Find conquer folder , and delete the file Chat.dll ( make a backup before ) 2.Take a dll from cohook and put it in conquer folder 3. Rename it to Chat.dll and is done :D PS: The little chat windows don't gonna appear more



All times are GMT +1. The time now is 05:41.


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.