Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 16.07.2005, 18:35   #1
MoSs
Архивный участник
 
Join Date: Jul 2005
Posts: 108
Default [TUTORIAL] How to setup L2 OFF server with dynamic ip

Let me make some things clear first
what this is NOT:
- tutorial for setting up L2 off server
- tutorial for troubleshooting a non working L2 off server

I assume that you are already familiar with the processes of L2 server
and you know the database the l2 uses well...
I assume that your L2 server works well ( you can connect and play on your server )
I assume that the l2authd.exe program runs on the same machine as the MSSQL Database
I also assume that your internet connection is on the machine where the l2authd program runs.

First of all you need a dynamic domain, dont worry, there are hundreds free out there. I recommend http://www.dyndns.org.
For the purpose of this tutorial i will assume you registered l2serv.dyndns.org domain

After you made your account and created a Dynamic DNS domain you need a program that can update your ip to the domain every time it changes. Use this one: http://www.directupdate.net/download.html i will explain why. (this is not freeware, expires in 60 days, but i'm sure you will find ways )

Install it on the machine where the DSN files reside. ( you will need the lin2db.dsn that you already created. By default it is in: C:\Program Files\Common Files\ODBC\Data Sources\lin2db.dsn)

After installation, setup your account that you made at the DynDNS site in the DirectUpdate program.

After you make sure that the DirectUpdate updates your ip to the domain correctly every time it changes. You will need the following javascript script that i made for this purpose:

Code:
var args = WScript.Arguments;
var Wsh = new ActiveXObject("WScript.Shell");
//Terminates the l2authd program
Wsh.Exec("taskkill /F /IM l2authd.exe");
//Wait 3 seconds
WScript.Sleep(3000);

//Connect to MSSQL
var conn = new ActiveXObject("ADODB.Connection");
//Change this path to whatever path you have the lin2db.dsn file
conn.Open("File Name=C:\\Program Files\\Common Files\\ODBC\\Data Sources\\lin2db.dsn")
//Update the ip  taken from the argument to the server with world id 1
conn.Execute("UPDATE server SET ip='"+args(0)+"' WHERE id=1");
conn.Close();
WScript.Sleep(3000);
//Run again the l2authd server
/* Change the command to your settings
for example cmd /D /C DRIVE & CD DRIVE:\\path\\to\\l2authd\\ & l2authd.exe
*/
Wsh.Run("cmd /D /C D: & CD D:\\ProjectC2-Beta3-Final\\NewAuth & l2authd.exe");

//This should work just fine, otherwise you did something wrong, double check paths...
Save the above code to a file: updateip.js

Now you need to open the administration module of direct update and select Actions and do the following:
"When a new Ip is detected..."
check: Launch the external application
click modify
Full path: %windir%\system32\wscript.exe
Parameters: \your\path\to\updateip.js *IP*
Sample image follows:



You can click test to see if it works correctly.
If it doesn't then you did something wrong!

Let me assure you that terminating and restarting the l2authd server does not crash neither the L2server nor the L2npc and the l2server will always try to reconnect to the l2authd.

Now all you need to do is to put the address you registered
on the dyndns site to your l2.ini
ServerAddr=l2serv.dyndns.org

After that you should be able to connect to your server anytime after the ip changes and no further actions should be required


Feel free to modify the javascript code and improve it if you like
It's kind of quick and dirty solution but works

Give me feedback of success/failure stories

Hope that tutorial helps cheers

(excuse my english, I'm greek :P)
MoSs is offline  
Old 16.07.2005, 19:04   #2
MoSs
Архивный участник
 
Join Date: Jul 2005
Posts: 108
Default

I have to add a few comments...
First of all I have seen people requesting this on ragezone but from ragezone I am really dissapointed people are NOT willing to share there... So there is no way to post this at ragezone...
Definately I hate replies of the type: "Use search you noob" and the like
when you do search and there is nothing to find. (I am almost convinced that they are deleting usefull posts there, for reasons I cant imagine)

I am glad people contribute stuff here so I would like to add my little thing as well

Keep sharing/contributing, I sure will as much as I can!

YOU CANNOT COPY MY POST AND PASTE IT ON RAGEZONE
I WILL BE PISSED IF I SEE SOMEONE DO THAT....

You can simply add a link to this post if you wanna help someone there...

Thank you (i got it out of my system ) :P
MoSs is offline  
Old 16.07.2005, 20:26   #3
Metalmurphy
Архивный участник
 
Join Date: Feb 2005
Posts: 766
Default

Well i can tell you that someone will do that. And for u to say DONT DO IT its only one more reason for them to actually DO it.

Anyway thanks for that java script. The update in the db is the only thing i actually needed but thks anyway
Metalmurphy is offline  
Old 16.07.2005, 22:12   #4
mrw00ter
Архивный участник
 
Join Date: Jul 2005
Posts: 6
Default

lol wow thats alota stuff, i just had to go into my router admin area and set it so it doesnt change ips auto. ><
mrw00ter is offline  
Old 16.07.2005, 22:26   #5
MoSs
Архивный участник
 
Join Date: Jul 2005
Posts: 108
Default

Quote:
Originally Posted by mrw00ter
lol wow thats alota stuff, i just had to go into my router admin area and set it so it doesnt change ips auto. ><
Well this tutorial is mainly for those that have dialup connections or DSL connections with not a static ip.
Its not intended for those that use DHCP (duhh omg!)
MoSs is offline  
Old 16.07.2005, 22:29   #6
MoSs
Архивный участник
 
Join Date: Jul 2005
Posts: 108
Default

Quote:
Originally Posted by Metalmurphy
Well i can tell you that someone will do that. And for u to say DONT DO IT its only one more reason for them to actually DO it.

Anyway thanks for that java script. The update in the db is the only thing i actually needed but thks anyway
Well whatever
If people believe that getting credit by using someone elses tutorial actually makes them something, are morons... and of course worthless pieces of shit :P

(sorry i cannot control my self :roll: )
MoSs is offline  
Old 04.08.2005, 10:19   #7
wton
Архивный участник
 
Join Date: May 2005
Posts: 463
Default

thanks for guia for noobs moss, but, uny question..

http://img215.imageshack.us/my.php?i...rorjava8ua.jpg

please, helpme..
thanks
wton is offline  
Old 05.08.2005, 11:51   #8
MoSs
Архивный участник
 
Join Date: Jul 2005
Posts: 108
Default

maybe you edited something that you should not...
MoSs is offline  
Old 22.08.2005, 00:49   #9
flakka
Архивный участник
 
Join Date: Mar 2005
Posts: 1,143
Default

Very cool. Thought I'd give it a whirl, and got this error.



Here's my script edited with my paths.

Code:
var args = WScript.Arguments; 
var Wsh = new ActiveXObject("WScript.Shell"); 
//Terminates the l2authd program 
Wsh.Exec("taskkill /F /IM C2AuthD_0500623.exe"); 
//Wait 3 seconds 
WScript.Sleep(3000); 

//Connect to MSSQL 
var conn = new ActiveXObject("ADODB.Connection"); 
//Change this path to whatever path you have the lin2db.dsn file 
conn.Open("File Name=C:\\Program Files\\Common Files\\ODBC\\Data Sources\\lin2db.dsn"); 
//Update the ip  taken from the argument to the server with world id 1 
conn.Execute("UPDATE server SET ip='"+args(0)+"' WHERE id=1"); 
conn.Close(); 
WScript.Sleep(3000); 
//Run again the l2authd server 
/* Change the command to your settings 
for example cmd /D /C DRIVE & CD DRIVE:\\path\\to\\l2authd\\ & l2authd.exe 
*/ 
Wsh.Run("C:\\server\\NewAuth\\C2AuthD_0500623.exe"); 

//This should work just fine, otherwise you did something wrong, double check paths...
It's mind boggling because paths are fine. Checked line 11 for the error and looks fine to me. Even changed it to FileDSN=C: and I still got the same error. It's driving me mad. :tard:

And yes, server is up and fully functional with no errors.
flakka is offline  
Old 23.08.2005, 00:58   #10
MoSs
Архивный участник
 
Join Date: Jul 2005
Posts: 108
Default

hmm!

My guess is that the .dsn file has some kind of a problem...
Open your lin2db.dsn file with a text editor...
it should look like this:
Code:
[ODBC]
DRIVER=SQL Server
UID=MoSs
Trusted_Connection=Yes
DATABASE=lin2db
WSID=LOCALHOST
APP=Microsoft Data Access Components
SERVER=LOCALHOST
Description=lin2db
edit:
I also noticed that you changed the last Run() function
I have a reason for running the authd with a cmd...
That is because windows scripting Run() function does not support a working path argument... If you run directly the .exe the working path is not where the executable is placed, this will produce an error in your authd program...
Running with cmd first changes drive, then changes directory and then runs the authd... Otherwise it will not work.

Code:
Wsh.Run("cmd /D /C D: & CD D:\\ProjectC2-Beta3-Final\\NewAuth & l2authd.exe");
MoSs is offline  
Old 23.08.2005, 01:12   #11
aseren
Архивный участник
 
Join Date: Feb 2005
Posts: 94
Default

OR!
you could just make a account on www.noip.com
and be done in 5 minutes.
aseren is offline  
Old 23.08.2005, 01:18   #12
MoSs
Архивный участник
 
Join Date: Jul 2005
Posts: 108
Default

Quote:
Originally Posted by aseren
OR!
you could just make a account on www.noip.com
and be done in 5 minutes.
Heheh as I said there are hundreds of sites out there providing free domains for dynamic ip update purpose, choose your favorite :P
MoSs is offline  
Old 23.08.2005, 01:38   #13
flakka
Архивный участник
 
Join Date: Mar 2005
Posts: 1,143
Default

OK, my lin2db.dsn looks like that save for the UID and server names.

Quote:
Originally Posted by MoSs
I also noticed that you changed the last Run() function
I have a reason for running the authd with a cmd...
I found out that my AuthD.exe didn't work after I posted that code. So you were right on that one. Fixed it back and changed the path name and it works fine.

The problem I'm getting is exactly what it says in the screenshot. "It's not a valid compund file." I even tried to compile the different parts of the javascript to see where the error was. So I tried this:

Code:
//Connect to MSSQL 
var conn = new ActiveXObject("ADODB.Connection"); 
//Change this path to whatever path you have the lin2db.dsn file 
conn.Open("File Name=C:\\Program Files\\Common Files\\ODBC\\Data Sources\\lin2db.dsn") 
//Update the ip  taken from the argument to the server with world id 1 
conn.Execute("UPDATE server SET ip='"+args(0)+"' WHERE id=1"); 
conn.Close(); 
WScript.Sleep(3000);
Exact same problem. Only instead of line 11, it's on line 4. So it has something to do with the dsn I assume. I just don't understand it. I've set up the servers many times without a problem whatsoever. It just doesn't like my lin2db.dsn file or something.

:banghead:
flakka is offline  
Old 23.08.2005, 02:05   #14
MoSs
Архивный участник
 
Join Date: Jul 2005
Posts: 108
Default

I understand your frustration about this, honestly I could not expect a problem like this... I 'll figure out another way to connect to MSSQL and I will post it!
MoSs is offline  
Old 23.08.2005, 02:21   #15
flakka
Архивный участник
 
Join Date: Mar 2005
Posts: 1,143
Default

Cool. Will be waiting for your update!
flakka is offline  
Old 22.09.2005, 05:30   #16
athlon64
Архивный участник
 
Join Date: Sep 2005
Posts: 24
Default

Isn't possible to make a script that connects directly to MSSQL not through ODBC ?
athlon64 is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 20:03.