Problem [message #225188] |
Fri, 06 October 2006 16:31 |
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 #225199 is a reply to message #225188] |
Fri, 06 October 2006 17:43 |
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 |
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 #225204 is a reply to message #225203] |
Fri, 06 October 2006 18:05 |
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 |
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 |
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 #225286 is a reply to message #225188] |
Sat, 07 October 2006 07:30 |
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.
|
|
|