|
You last visited: Today at 04:52
Advertisement
TotalLogged.txt
Discussion on TotalLogged.txt within the CO2 Private Server forum part of the Conquer Online 2 category.
10/08/2010, 21:17
|
#1
|
elite*gold: 0
Join Date: Oct 2010
Posts: 28
Received Thanks: 4
|
TotalLogged.txt
hey, my friend helped me so that when someone logs out, it will erase 1 number from totallogged.txt. so how can i make it that when i exit the console, it will make the number in totallogged.txt 0?
Here is the void but I don't know what to write in it to make it 0:
Code:
public void Disconnect()
{
try
{
if (!Robot)
{
if (Soc.Connected)
{
Soc.Shutdown(SocketShutdown.Both);
LogOff(true);
Soc.Close();
}
}
else
LogOff(true);
}
catch (Exception Exc) { Program.WriteLine(Exc); }
}
|
|
|
10/08/2010, 21:36
|
#2
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
|
So Disconnect() is what you call when a client disconnects?
Simply have a variable in your server to hold how many are logged.
Whenever you receive a new connection do something like.
Program.TotalOnline++; Then write the text file (using number online, overwrite whatever is in there is easiest)
Then when calling Disconnect() do Program.TotalOnline--; and update file again.
Why use a .txt though? Personally I'd do a sql database so you can read it easier on a website.
|
|
|
10/08/2010, 21:46
|
#3
|
elite*gold: 0
Join Date: Oct 2010
Posts: 28
Received Thanks: 4
|
I am just trying to make the the text say "0" instead of like 10 or 12 etc when I type /exit in the console. Because right now, it's set to -1 when someone logs off, but when I type /exit, they won't have the chance to log off, so that will mess up my server status, you get what I'm saying?
|
|
|
10/09/2010, 00:03
|
#4
|
elite*gold: 0
Join Date: Jun 2009
Posts: 787
Received Thanks: 314
|
Code:
[color=mediumturquoise]File[/color][color=black].WriteAllText([/color][color=darkred]"TotalLogged.txt"[/color][color=black], [/color][color=darkred]"0"[/color][color=black]);[/color]
|
|
|
10/09/2010, 00:39
|
#5
|
elite*gold: 0
Join Date: Oct 2010
Posts: 28
Received Thanks: 4
|
fixed it thanks
|
|
|
10/09/2010, 00:46
|
#6
|
elite*gold: 0
Join Date: Sep 2008
Posts: 178
Received Thanks: 62
|
Quote:
Originally Posted by tomtucker
It ain't working. This is what I put:
Code:
public void Disconnect()
{
try
{
File.WriteAllText("C:\\AppServ\\www\\TotalLogged.txt", "0");
if (!Robot)
{
if (Soc.Connected)
{
Soc.Shutdown(SocketShutdown.Both);
LogOff(true);
Soc.Close();
}
}
else
LogOff(true);
}
catch (Exception Exc) { Program.WriteLine(Exc); }
}
|
That's not the /exit command.
|
|
|
10/09/2010, 01:11
|
#7
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
|
Decker, when are you going to learn to read code, and actually LEARN what the hell you're doing? You come to us with EVERY problem you have, and frankly a lot of us are tired of it. You're spoonfed beyond belief, you're like a 5 year old that's still on breastmilk, you don't learn to adapt. Read some tutorials, learn exactly what the hell you're doing, so you won't have to come to us all the time.
|
|
|
10/09/2010, 01:13
|
#8
|
elite*gold: 0
Join Date: Oct 2010
Posts: 28
Received Thanks: 4
|
Quote:
Originally Posted by Аrco
Decker, when are you going to learn to read code, and actually LEARN what the hell you're doing? You come to us with EVERY problem you have, and frankly a lot of us are tired of it. You're spoonfed beyond belief, you're like a 5 year old that's still on breastmilk, you don't learn to adapt. Read some tutorials, learn exactly what the hell you're doing, so you won't have to come to us all the time.
|
You don't know who is tired of it, so stop putting words in other peoples mouths.
|
|
|
10/09/2010, 06:52
|
#9
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
|
#tiredofit
You could have learned to be at LEAST a decent coder by now if you actually put a tiny bit of effort into it.
|
|
|
10/09/2010, 06:55
|
#10
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
|
Quote:
Originally Posted by pro4never
#tiredofit
You could have learned to be at LEAST a decent coder by now if you actually put a tiny bit of effort into it.
|
This was said many times. He just refuses to listen, and leeches off everyone else. Which I think is why his server is down atm
|
|
|
10/09/2010, 14:43
|
#11
|
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 505
|
Quote:
Originally Posted by pro4never
#tiredofit
You could have learned to be at LEAST a decent coder by now if you actually put a tiny bit of effort into it.
|
If thats the case, why are there so few decent coders on this forum?
There's some people who get along with the .NET framework, but thats about it for most of the 'coders' on this forum.
|
|
|
10/09/2010, 14:49
|
#12
|
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
|
Quote:
Originally Posted by Аrco
This was said many times. He just refuses to listen, and leeches off everyone else. Which I think is why his server is down atm
|
hehe.
|
|
|
All times are GMT +2. The time now is 04:52.
|
|