The online racing simulator
3 Errors opening file (txt)
1
(31 posts, started )
#1 - sun
3 Errors opening file (txt)
Hi

i got a problem when i added this into my InSim script:
'if
(File.Exists(@"C:\insim\database\" + NCN.UName + ".txt"))'.

now the errors are: Error 1 } expected C:\Documents and Settings\Owen\Desktop\LFS_External_Client\Form1.cs 401 1 LFS_External_Client
Error 2 Invalid expression term 'private' C:\Documents and Settings\Owen\Desktop\LFS_External_Client\Form1.cs 473 9 LFS_External_Client
Error 3 ; expected C:\Documents and Settings\Owen\Desktop\LFS_External_Client\Form1.cs 473 17 LFS_External_Client.

Can any one help ?

Thanks!

Regards,

Owen.
So you wrote a conditional statement without an expression behind it?
#3 - sun
? wat ?
#4 - sun
am i missing some punctuation somewhere ?
Read this. Learn.
Edit: Meh, ignore me.
#7 - sun
Dude i'am getting sick of you! i'am reading what Nova told me and end ofi mean James-F1 not you dark times your helpfull
You're getting sick of someone giving you a link to somewhere that explains how you can solve the error, and thereby learn in the process?

Wow, I must be such a jerk.
Quote from sun :? wat ?

It's like writing "sfhkjbdakj" in a letter to someone else. He won't understand what you mean, because it's not in his dictionary
Sun, I am only helping because I can give an answer that is dealing with the syntax of the language... you need to make sure your not touching private data inside of the class that your accessing.

If you don't know what the difference of public, private and protected attributes are on the members/methods of a class then Click

That may not be the best tutorial on it but I am at work and found the first link...
#11 - sun
Now i get this error:

Error 2 'LFS_External_Client.In.NCN(LFS_External.InSim.Packets.IS_NCN)' is a 'method', which is not valid in the given context C:\Documents and Settings\Owen\Desktop\LFS_External_Client\Form1.cs 401 47 LFS_External_Client

if you know whats wrong please reply to this topic,thread.

That probably means that you cannot write NCN.something but you have to write NCN(<Your IS_NCN Packet>).something.

But it's really not easy to help you without knowing the code or at least a part of it.
-
(eimer_) DELETED by eimer_ : just random blabla
#13 - sun
ok but its easy for things to be explaned to me then i understand.
sun, if you don´t go to bed now, then you´ll be late for school tomorrow!
#15 - sun
lol your like my mother xD. ok bed but add me on msn my addy is [email protected] i'am online posting posts on my psp at night and juring the day i post on my PC. And i go on msn on my psp to at night. xD.
Quote from sun :lol your like my mother xD. ok bed but add me on msn

surely not
Sun, does any of `your` program contain code which you've actually created?

I find it hard to believe you know anything about sending packets over a network if you can't open a file...

Laugh of it is, your program is (probably) a copy & paste job of other peoples code and if you ever get anything that works you'll claim it all as your own.

Learn to crawl before trying to run
LOL here we go again.....:something:something:something

Sun, seriously.... go away and learn...
Hey, Sun.

Just try to fix the Errors.
When you try and try and try you learn how did you fix errors.

Greetz Marco
Guys, as much as we try hes not going to go away and learn by himself, he doesn't seem to have that motivation - although he seems to want something bad enough to constantly as for stuff given to him... If he learns what we are trying to say and actually goes out trying to read and learn the concepts of what hes trying to do, the syntax of the language and some errors that it gives, and shows us all some motivation to do something then we should help, obviously!

But I say don't even post anything else in his threads since that hint will give him more then he needs to know. So sun, I see your effort in asking people to do things pretty much for you - but I don't see your effort in learning how to program yourself... Please show us your prepared to learn and do what it takes...
The problem is not his motivation to do something, the problem is him just copy-pasting any code he's given and not even attempting to understand why it errors. As a result, someone may as well just write it for him and give it to him... it'd teach him just as much.
#22 - sun
Hey Guys i fixed all my errors! i'am happy with that. only one slight problem. heres the code:


[SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][SIZE=2] NCN([/SIZE][SIZE=2][COLOR=#2b91af]Packets[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#2b91af]IS_NCN[/COLOR][/SIZE][SIZE=2] NCN)
{
InSim.Send_BTN_CreateButton([/SIZE][SIZE=2][COLOR=#a31515]"^7Cash:"[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#2b91af]Flags[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#2b91af]ButtonStyles[/COLOR][/SIZE][SIZE=2].ISB_DARK, 5, 17, 20, 5, 2, NCN.UCID, 1, [/SIZE][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][SIZE=2]);
AddToConnectionsList(NCN); [/SIZE][SIZE=2][COLOR=#008000]// Adds new player to the Connections[] list (don't remove line!)
[/COLOR][/SIZE][SIZE=2][COLOR=#2b91af]Debug[/COLOR][/SIZE][SIZE=2].WriteLine(NCN.UCID.ToString() + [/SIZE][SIZE=2][COLOR=#a31515]" NCN"[/COLOR][/SIZE][SIZE=2]);
[/SIZE][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#2b91af]File[/COLOR][/SIZE][SIZE=2].Exists([/SIZE][SIZE=2][COLOR=#a31515]@"C:\Database\"[/COLOR][/SIZE][SIZE=2] + NCN.UName + [/SIZE][SIZE=2][COLOR=#a31515]".txt"[/COLOR][/SIZE][SIZE=2])!=[/SIZE][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][SIZE=2])
[/SIZE][SIZE=2][COLOR=#2b91af]File[/COLOR][/SIZE][SIZE=2].Create(NCN.UName + [/SIZE][SIZE=2][COLOR=#a31515]".txt"[/COLOR][/SIZE][SIZE=2]);
}

Thats the code, and when i join my server an i look at back my file where its supposed to save - and its not there. hmmm i'am thinking my self, can any one help to ?
[/SIZE]


string path = @"C:\Database\";

private void NCN(Packets.IS_NCN NCN)
{
InSim.Send_BTN_CreateButton("^7Cash:", Flags.ButtonStyles.ISB_DARK, 5, 17, 20, 5, 2, NCN.UCID, 1, false);
AddToConnectionsList(NCN); // Adds new player to the Connections[] list (don't remove line!)
Debug.WriteLine(NCN.UCID.ToString() + " NCN");
if (!File.Exists(path + NCN.UName + ".txt"))
File.Create([B]path + [/B]NCN.UName + ".txt");
}

You can then also make an accessible property to get/set the path variable.
#24 - sun
k is it sorted ?
Quote from sun :File.Create(NCN.UName + ".txt");

Before the NCN.Uname, you must declare what path you want the file to be created in...At the moment (if the code is working...) it's in the same folder as the exe.

Try this: File.Create(@"C:\database\users\" + NCN.UName + ".txt");

That will put the file in C:\database\users...
1

3 Errors opening file (txt)
(31 posts, started )
FGED GREDG RDFGDR GSFDG