Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Problem
Problem [message #225188] Fri, 06 October 2006 16:31 Go to next message
extreme_sol is currently offline  extreme_sol
Messages: 14
Registered: November 2005
Karma: 0
Recruit
How do i output a player IP address.

E.g

char tmp[128];

sprintf(tmp,"%f",Get_IP_Address(pID));

pID = Get_Player_ID(player) incase you wondered

%f gives me a value of 01.00000 or somthing?

[Updated on: Fri, 06 October 2006 16:31]

Report message to a moderator

Re: Problem [message #225194 is a reply to message #225188] Fri, 06 October 2006 17:01 Go to previous messageGo to next message
Zion is currently offline  Zion
Messages: 2722
Registered: April 2006
Karma: 1
General (2 Stars)
Use the console command, "PINFO".
Re: Problem [message #225196 is a reply to message #225188] Fri, 06 October 2006 17:04 Go to previous messageGo to next message
extreme_sol is currently offline  extreme_sol
Messages: 14
Registered: November 2005
Karma: 0
Recruit
Thats not going to help me get there IP address from scripts.dll
Re: Problem [message #225198 is a reply to message #225196] Fri, 06 October 2006 17:38 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3812
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
Why do you want other people's IP address?

[Updated on: Fri, 06 October 2006 17:39]

Report message to a moderator

Re: Problem [message #225199 is a reply to message #225188] Fri, 06 October 2006 17:43 Go to previous messageGo to next message
extreme_sol is currently offline  extreme_sol
Messages: 14
Registered: November 2005
Karma: 0
Recruit
If you havn't got a solution please dont reply, the IP address is for logs as so would Ping and and Port and Score and Team etc etc.
Re: Problem [message #225201 is a reply to message #225198] Fri, 06 October 2006 17:45 Go to previous messageGo to next message
Ivan275 is currently offline  Ivan275
Messages: 41
Registered: August 2006
Karma: 0
Recruit
try changing %f to %s
%f is for floats and the IP is returned as a character string

Quote:

If you havn't got a solution please dont reply,
I know, don't you hate it when you ask a question and then ppl start asking why you need it or criticizing you instead of giving you an answer..

[Updated on: Fri, 06 October 2006 17:48]

Report message to a moderator

Re: Problem [message #225203 is a reply to message #225188] Fri, 06 October 2006 17:48 Go to previous messageGo to next message
extreme_sol is currently offline  extreme_sol
Messages: 14
Registered: November 2005
Karma: 0
Recruit
%s seems to crash FDS for some reason
Re: Problem [message #225204 is a reply to message #225203] Fri, 06 October 2006 18:05 Go to previous messageGo to next message
Ivan275 is currently offline  Ivan275
Messages: 41
Registered: August 2006
Karma: 0
Recruit
i just checked and it works for me. here is a small code that works with out crashing.
	char KickMsg[256];
	sprintf(KickMsg,"msg %s IP: %s you are beeing kicked for cheating!",Get_Player_Name(damager),Get_IP_Address(Get_Player_ID(damager)));
	Console_Input(KickMsg);
I wonder when you use %s the crash happens when you try to save a string as something else. But I guess not...

Try to isolate where the crash happens. // out everything except the sprintf command then allow your code a few lines at a time after each run the server and see if it crashes...

I had stupid mistakes that I just didn't see. I thought it was line 1 or 2 and kept messing with them but it ended up a wrong setting somewhere else. I would of never found it without doing a host message for every command I had 1 line at a time.

[Updated on: Fri, 06 October 2006 18:14]

Report message to a moderator

Re: Problem [message #225207 is a reply to message #225188] Fri, 06 October 2006 18:14 Go to previous messageGo to next message
extreme_sol is currently offline  extreme_sol
Messages: 14
Registered: November 2005
Karma: 0
Recruit
char Message[256];
sprintf(Message,"TEST;%s;%d;%d;%d;%s;%d;%s" ,Get_Player_Name(player),Get_Player_ID(player),int(Commands- >Get_Points(player)),int(Commands->Get_Money(player)), Commands->Get_Preset_Name(player),Commands->Get_Health(player), Get_IP_Address(Get_Player_ID(player)));


This doesn't work for me :/

No it's defintely the IP part everything else works fine.

[Updated on: Fri, 06 October 2006 18:23]

Report message to a moderator

Re: Problem [message #225211 is a reply to message #225207] Fri, 06 October 2006 19:18 Go to previous messageGo to next message
Ivan275 is currently offline  Ivan275
Messages: 41
Registered: August 2006
Karma: 0
Recruit
ok this is weird... hum try this... I know it looks stupid...

char Message[150];
char Message1[50];
char Message2[256];

sprintf(Message,"TEST;%s;%d;%d;%d;%s;%d;" ,Get_Player_Name(player),Get_Player_ID(player),int(Commands->Get_Points(player)),int(Commands->Get_Money(player)), Commands->Get_Preset_Name(player),Commands->Get_Health(player));
sprintf(Message1,"%s", Get_IP_Address(Get_Player_ID(player)));
sprintf(Message2,"%s%s",Message,Message1);

[Updated on: Fri, 06 October 2006 19:18]

Report message to a moderator

Re: Problem [message #225230 is a reply to message #225188] Fri, 06 October 2006 21:34 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3812
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
Renegade keeps track of money and score (even if you quit the game and then rejoin) automatically, and if you kick some one, people do know of ways to change their computers IP address.

Re: Problem [message #225279 is a reply to message #225194] Sat, 07 October 2006 05:49 Go to previous messageGo to next message
Zion is currently offline  Zion
Messages: 2722
Registered: April 2006
Karma: 1
General (2 Stars)
Merovingian wrote on Sat, 07 October 2006 01:01

Use the console command, "PINFO".

Re: Problem [message #225286 is a reply to message #225188] Sat, 07 October 2006 07:30 Go to previous message
extreme_sol is currently offline  extreme_sol
Messages: 14
Registered: November 2005
Karma: 0
Recruit
Merovingian, i said shut up, why would i want to use PINFO inside scripts.dll. Ivan275 Thanks for your help i have it sorted now, im not actually sure what was wrong but i re-wrote it and it seems to work now.
Previous Topic: Purchase Terminal Presets...
Next Topic: Does anyone have w3d_file.h?
Goto Forum:
  


Current Time: Thu Dec 12 10:51:08 MST 2024

Total time taken to generate the page: 0.01491 seconds