Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Information Gathering
Re: Information Gathering [message #435419 is a reply to message #435291] Tue, 24 August 2010 15:22 Go to previous messageGo to previous message
dr3w2 is currently offline  dr3w2
Messages: 485
Registered: September 2006
Location: Ottawa,Canada
Karma:
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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: "Reborn Hud"
Next Topic: Renegade X is looking for Coders and Character Artists
Goto Forum:
  


Current Time: Wed Jul 31 06:12:56 MST 2024

Total time taken to generate the page: 0.00636 seconds