View Full Version : .NET (C#) - Open Source Cruise Server (Mod)(Functional, but unfinished)
elmohellno
3rd September 2008, 02:39
Well I have had no motivation lately to finish this, I might some day though...
Anyways there are a few bugs (should really open the db each query group instead of leaving it open).
And a ton of wip shit... (Functional but not finished)
•Command System
•Mysql
•Connection Struct
•MCI Handler
•Status System
•ATM (o lawd)
•Lots more
All the WIP stuff is functional it is just a wip :scratchch.
If lots of people are interested I might finish it but I have no reason atm (Don't play LFS much right now).
Download:
http://rapidshare.com/files/142196803/lfs_external_csf11.rar.html
Note: "MWAH4HA Y0U LEFt YOUr InFo IN!", The server has been dead forever, I don't care...
Dygear
10th September 2008, 00:18
How big is the file? Can't upload it here?
Only ask because I hate rapidshare.
misiek08
11th September 2008, 06:23
~1,3MB - this is the size.
elmohellno
12th September 2008, 11:29
added an attachment.
sun
17th September 2008, 19:32
i get errors:
Are you sure this code works? because it doesnt... Why upload when it doesnt?:shrug:
keiran
17th September 2008, 20:35
Are you sure this code works? because it doesnt... Why upload when it doesnt?:shrug:
.NET (C#) - Open Source Cruise Server (Mod)(unfinished)
Might want to ask yourself the same question... (i.e your `tutorial` on writing files in PHP)
dawesdust_12
17th September 2008, 20:39
Also, Sun - It'd likely (this is a completely uninformed guess) work if you had the mysql.dll in the project, so it knows where to find all the functions in the MySQL namespace.
sun
17th September 2008, 22:24
thx dawesdust...
-------------------------------
Well, if it is unfinished, he should of still made it worked for people to learn from! not make errors!
elmohellno
18th September 2008, 14:48
thx dawesdust...
-------------------------------
Well, if it is unfinished, he should of still made it worked for people to learn from! not make errors!
If you cannot figure out how to fix these errors you really need to go read more tutorials.
http://dev.mysql.com/downloads/connector/net/5.0.html
Why am I even helping...
sun
18th September 2008, 19:46
Because your the kind of person who does.
dawesdust_12
18th September 2008, 21:13
... yes, but you're incapable of helping yourself or learning by yourself.
elmohellno
19th September 2008, 02:14
Because your the kind of person who does.
Too tired, was that an insult?
sun
19th September 2008, 16:21
no..
sun
19th September 2008, 16:41
Anyways, i think i found my problem... Theres a file missing in the Reerences called 'MySQL.Data'. Has anybody else have the file?
elmohellno
19th September 2008, 18:12
wow just wow.
dawesdust_12
19th September 2008, 19:29
wow just wow.
I think that yet again, we opened another Pandoras Box of sun.
<prepares for my imminent ban for losing my head>
the_angry_angel
19th September 2008, 22:12
sun, you've been given the solution. Install the MySQL development libraries for .NET.
If you're unclear as to how to proceed either approach someone in private who uses .NET, or read up on that library and understand how to integrate it into your project.
It's been made clear that ignorance is no longer an excuse and you will get the same treatment as others who taunt you. The reason being that you are the other half of the problem.
<prepares for my imminent ban for losing my head>No ban, but there are infractions. For both parties involved.
Responding in the way that people have to sun is half of the problem. I am fed up with saying this politely - if you aren't giving advice, and you only want to troll, **** off.
I'll remove all the crap from this thread in a few days time.
dawesdust_12
20th September 2008, 03:17
Karl, no disrespect intended but we did help him, we told him what was missing (and a quick google search regards the missing thing as the first result, even with an installer.) We offered him advice and help, yet he is incapable of following even the most basic instructions.
After over a year of this, he is still incapable of thinking for himself, or analyzing basic errors from a compiler, and even tossing them into google. He treats the last thread he posted in as if it's a global IM, and we're all his personal support team. It's not even that he comes here with a descriptive question as to why 1 thing isn't working, he's posting huge questions as if he hasn't even tried. For example, his "Lottery system" thread, along with his button system fiascos.
Like, if he tried, then fine, but it's like he expects us to all be his personal coders and I think that if that's the case, then the Programmer forum -- particularly anywhere NOT the request forum -- is not the place for him.
I'm sorry for this reply, but I'm sorry - his attempts at "programming" have been as successful as my attempts at 3d modelling.
dougie-lampkin
20th September 2008, 19:35
I'm sorry for this reply, but I'm sorry - his attempts at "programming" have been as successful as my attempts at 3d modelling.
I have proof ;)
the_angry_angel
21st September 2008, 11:43
We offered him advice and help, yet he is incapable of following even the most basic instructions.I'm not disputing that. I am disputing how this whining and bitch reoccurs over and over and over again.
He treats the last thread he posted in as if it's a global IM, and we're all his personal support team.No one is forcing you to read or reply. Ignore him if you do not want to deal with him. This is the crux of my issue with the "sun situation".
If you ignore him and his questions go unanswered, then he will be forced to search and learn. If he can't then maybe something will sink in.
The way in which people continually answer his questions, then moan and bitch when he doesn't "get it" is making this place a nasty place to post. I cannot for the life of me see this happening if we were all in the same room together. Would you really all sit there and go "haha, you're shit!"? Equally though the point that "you need to go and learn the BASICS before you can do everything" would also be hammered home to sun a lot more easily.
master_lfs.5101
25th October 2008, 03:00
is there any database file to upload to mysql? How do i get this to work.
master_lfs.5101
27th October 2008, 00:43
Can someone help?
I don't get how to use this.
I got this to work, it starts but i dunno how to make it connect to Insim, it turns on and does nothing. :shrug:
Bose321
2nd May 2009, 00:58
Great job bumping this. You have changed IP, Pass and port settings?
Ofcourse i have, i suspect its my SQL file, i dont understand the kines where like From Useres Where USERNAME, do i have to change something there?:shrug:
query.CommandText = query.CommandText.Substring(0,query.CommandText.Le ngth-2);
query.CommandText+=" FROM Users WHERE username='" + Escape(c.Username) + "'";
query.Prepare();
MySqlDataReader dr = query.ExecuteReader();
if (dr.HasRows)
{
foreach (FieldInfo mi in typeof(clsConnection).GetFields())
{
foreach (StatsAttribute a in mi.GetCustomAttributes(typeof(StatsAttribute), false))
{
dr.Read();
if (mi.FieldType.Name == "String")
{
mi.SetValue(c, (object)dr.GetString(a.Name));
}
else if (mi.FieldType.Name == "Int32")
{
mi.SetValue(c, (object)dr.GetInt32(a.Name));
}
else if (mi.FieldType.Name == "Byte")
{
mi.SetValue(c, (object)dr.GetByte(a.Name));
}
}
}
}
else
{
dr.Close();
return false;
}
dr.Close();
return true;
}
public void AddUser(clsConnection c)
{
if (c.Username == "")
return;
List<string> users = new List<string>();
List<string> values = new List<string>();
int i = 0;
foreach (FieldInfo mi in typeof(clsConnection).GetFields())
{
foreach (StatsAttribute a in mi.GetCustomAttributes(typeof(StatsAttribute), false))
{
users.Add(a.Name);
values.Add("'" + mi.GetValue(c) + "'");
i++;
}
}
string query = "INSERT INTO Users(" + string.Join(",", users.ToArray()) + ") VALUES (" + string.Join(",", values.ToArray()) + ");";
Query(query);
}
public void UpdateUser(clsConnection u)
{
if (u.Username == "")
return;
string query = "UPDATE Users SET ";
foreach (FieldInfo mi in typeof(clsConnection).GetFields())
{
foreach (StatsAttribute a in mi.GetCustomAttributes(typeof(StatsAttribute), false))
{
if (a.Name != "username" && a.Name != "joindate")
query += a.Name + "='" + Escape(mi.GetValue(u).ToString()) + "', ";
}
}
query = query.Substring(0, query.Length - 2);
query += " WHERE username='" + Escape(u.Username) + "';";
Query(query);
}
public void AddCar(string username, string car)
{
Query("INSERT INTO " + car + "(username) VALUES ('" + Escape(username) + "');");
}
public List<string> GetCars(string username)
{
if (username == "")
return new List<string>();
List<string> ret = new List<string>();
MySqlCommand query = new MySqlCommand();
query.Connection = SQL;
query.CommandText = "";
foreach (string s in Cars)
query.CommandText+= "SELECT * FROM " + s + " WHERE username='" + Escape(username) + "';";
query.Prepare();
MySqlDataReader dr = query.ExecuteReader();
int i = 0;
do
{
while (dr.Read())
{
if (dr.GetString(0) != "")
{
ret.Add(Cars[i]);
}
}
i++;
} while (dr.NextResult());
dr.Close();
return ret;
}
public void RemoveUser(string username)
{
Query("DELETE FROM Users WHERE username='" + Escape(username) + "'");
}
public bool GetOfficer(string username)
{
if (username == "")
return false;
MySqlCommand query = new MySqlCommand();
query.Connection = SQL;
query.CommandText = "SELECT * FROM Police WHERE username='" + Escape(username) + "';";
query.Prepare();
MySqlDataReader dr = query.ExecuteReader();
if (dr.HasRows)
{
dr.Close();
return true;
}
dr.Close();
return false;
}
public void RemoveOfficer(string username)
{
Query("DELETE FROM Police WHERE username='" + Escape(username) + "'");
}
public void AddOfficer(string username)
{
Query("INSERT INTO Police(username) VALUES ('" + Escape(username) + "');");
}
public void RemoveCar(string username, string car)
{
Query("DELETE FROM " + car + " WHERE username='" + Escape(username) + "'");
}
public bool StartUp()
{
try
Bose321
2nd May 2009, 17:42
Don't think so. Just don't understand why you use the SQL version, it's so much more work :shrug:
The only reason is i need the MCI handler to remove the 9 player thing :(
EDIT: Ok got it to connect, now when it connects, it wont connect to SQL, it says 'SQL Not Loaded' 'Retrying in 5 minutes'
high6
7th July 2009, 23:03
I really want to start working on this again or well actually rebuild it from scratch but I no longer have an S2 license.
Would anyone be interested in donating a few bucks to me towards getting an S2 license?
Marco1
15th July 2009, 08:26
NO !
why you havent S2 anymore?
u cant lose ur S2 license..u can only bet banned
pfff!
Check yuor UserName, Password Is EXACTLY THE SAME IN THE Form1.cs.
See if you can log into MySQL in the MySQL Administrator. Once done you will need to make a Database. Go into Catalogs, and right click in the left, and click on
Create Schema
Once done that call your database ( e.g Insim ). Press ok, and make sure you have full Rights in your database User, else you will go no where.
Now fill in the Insim.
Edit either these lines:
DBUSER ( Your Username to login into MYSQL )
DBPASS ( Your password to login into MySQL )
DB ( Your Database Name )
DBPORT - IF THERE IS ONE IN THE INSIM!
Now compile. Either press F5.
high6
23rd July 2009, 23:42
NO !
why you havent S2 anymore?
u cant lose ur S2 license..u can only bet banned
It was my friends account and he changed the password :P.
PoVo
29th October 2009, 21:55
It was my friends account and he changed the password :P. Account sharing is not allowed!
sun
29th September 2010, 22:22
I cant seem to get this to connect to the server. No matter how many ways I try...... the port is set to the default:29999 and the IP: 127.0.0.1 since its running on the same machine, and adminpw is exactly right.
sun
30th September 2010, 22:27
No one answering?
broken
30th September 2010, 22:52
Obviously not, I don't see any replies between the two you've made. ;)
sun
1st October 2010, 15:56
haha :)
Anyways, I need help on why it is not connecting?
dawesdust_12
1st October 2010, 16:43
Debug it then. Debugging is a key skill of a programmer.
sun
1st October 2010, 17:30
I've already tried that
dawesdust_12
1st October 2010, 17:44
No. I mean debug the problem, don't just compile a debug version. Create breakpoints, walk through to see where the problem is. You're working in C#... a language that makes debugging so painfully simple, it should be criminal.
broken
1st October 2010, 17:52
I've already tried that
Obviously, not well enough. Try more, maybe?
Damn it..
sun
1st October 2010, 18:39
hmm..... yes I guess....... I think it is something to do with everytime i close the app it throws an un acceptional error
sun
1st October 2010, 18:59
Right. I've replaced the following line to:
// InSim connection settings
InSimSettings Settings = new InSimSettings("127.0.0.1", 25555, 0, Flags.InSimFlags.ISF_MSO_COLS | Flags.InSimFlags.ISF_MCI, '!', 500, AdminPW, "^1[^4RAF^1]", 5);
That should connect... but it doesn't...... Would you like to see my LFS DEDI setup.cfg to?
MariusMM
1st October 2010, 19:05
Try to connect it with another IP then 127.0.0.1? It might be blocked by something?
sun
1st October 2010, 19:08
Hi, MariusMM - Long time :thumbsup:
-------------------------------------------
nope, 127.0.0.1 cant be blocked as its the localhost.
sun
1st October 2010, 19:44
I think there is a big problem with this insim.... Marius has tried to solve the problem but we both cannot find anything wrong with it, everything is fine.
MariusMM
1st October 2010, 19:49
No... I never said it was fine... I just said I don't know what's wrong, and I won't spend more time on a Friday night trying to solve it.
PoVo
1st October 2010, 19:53
I think there is a big problem with this insim.... Marius has tried to solve the problem but we both cannot find anything wrong with it, everything is fine.
I solved it. The answer is the MYSQL connections string is wrong :)
sun
1st October 2010, 20:12
Finally.... It connects to the server. Ok, since thats out of the way, now it wont connect to my SQL. I dont understand the way this code has been set out but is this right, if:
server is localhost
DB: wwclfscruise
UID: root
Pwd: test15
void OpenDatabase(string server, string database, string username, string password)
{
SQL.ConnectionString = "Server=localhost" + server +
"Database=wwclfscruise" + database +
"Uid=root" + username +
"Pwd=test" + password +
"Connect Timeout=30;";
SQL.Open();
}
EDIT: Delete this post. forget about this problem Its solved. Thanks for the help!
broken
1st October 2010, 20:15
Finally.... It connects to the server. Ok, since thats out of the way, now it wont connect to my SQL. I dont understand the way this code has been set out but is this right, if:
server is localhost
DB: wwclfscruise
UID: root
Pwd: test15
void OpenDatabase(string server, string database, string username, string password)
{
SQL.ConnectionString = "Server=localhost" + server +
"Database=wwclfscruise" + database +
"Uid=root" + username +
"Pwd=test" + password +
"Connect Timeout=30;";
SQL.Open();
}
Are you serious? I really am NOT going to help you. I think this is the first time I have ever said this. Look your code up VERY VERY carefully. The mistake is too obvious not to see. I mean.. Are you REALLY serious? Cause if you are, then I am really amazed..
Also - debug. And not only debug - but debug efficiently. Or throw errors in built versions, or whatever you want. Just find a way to output error messages. And not error messages that you get while compiling (string can't be int and the likes), but runtime error messages. Try using try maybe?
sun
1st October 2010, 22:11
Ok, since everything is working, has anyone got the layout for AS5 for this track?
sun
2nd October 2010, 09:57
or how would i know were to cash in a lottery ticket for example?
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.