Information Gathering [message #435291] |
Sun, 22 August 2010 09:55 |
|
Omar007
Messages: 1711 Registered: December 2007 Location: Amsterdam
Karma: 0
|
General (1 Star) |
|
|
Well the title could probably be better but what the hell
I have a few questions I would like someone to answer:
1. How do I get the server IP when I'm a client through scripts/shaders?
2. How do I get the nickname I'm connecting with scripts/shaders? (a way that works with WOL and DirectConnect)
3. Can I easily get the server name through scripts or should I just read the "wGameTitle=" entry in "svrcfg_cnc.ini" (or what other file is selected in server.ini)?
I think that is it
[Updated on: Sun, 22 August 2010 09:58] Report message to a moderator
|
|
|
|
|
Re: Information Gathering [message #435300 is a reply to message #435291] |
Sun, 22 August 2010 14:06 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
I was referring to hooking the clients connection, not the server's. However, you're right, that would only work for XWIS clients.
I suppose you could hook the client chat, and have the server send this information on player join?
What you really want to do is actually possible, as I have inquired about this too, but I am not sure how.
[Updated on: Sun, 22 August 2010 14:08] Report message to a moderator
|
|
|
Re: Information Gathering [message #435419 is a reply to message #435291] |
Tue, 24 August 2010 15:22 |
dr3w2
Messages: 485 Registered: September 2006 Location: Ottawa,Canada
Karma: 0
|
Commander |
|
|
Not sure which if all of your questions were based client side or server side.
Anyways this is what I did client side, using shaders.dll
Omar007 wrote on Sun, 22 August 2010 11:55 | 1. How do I get the server IP when I'm a client through scripts/shaders?
|
int server_ip = The_Game()->IP;
The resulting IP is in integer/long notation, you'll have to convert it if you want it string dotted notation. One method of conversion is the following:
struct in_addr addr;
addr.s_addr = The_Game()->IP;
char *dot_ip = inet_ntoa(addr);
Omar007 wrote on Sun, 22 August 2010 11:55 | 2. How do I get the nickname I'm connecting with scripts/shaders? (a way that works with WOL and DirectConnect)
|
To my knowledge, this can only be called AFTER the first frame has been drawn. When I tried calling it otherwise I received a null pointer on obj.
GameObject *obj = (GameObject *)(*TheStar)->obj;
char *player_name = Get_Player_Name(obj);
Omar007 wrote on Sun, 22 August 2010 11:55 | 3. Can I easily get the server name through scripts or should I just read the "wGameTitle=" entry in "svrcfg_cnc.ini" (or what other file is selected in server.ini)?
|
Do you mean xwis/wol server name or server name/title? The following below gets the game title (Ex: n00bstories AOW)
char *server_name = WideCharToChar(The_Game()->GameTitle);
n00bstories Server Administrator
[Updated on: Tue, 24 August 2010 15:36] Report message to a moderator
|
|
|
|