Get IP address string
#1
Hey guys,

I'm trying to script a buddy list. The only problem is, while I seem to be able to echo (strstr IP_PARTIAL (whois CN)), I don't seem to be able to extract the IP to add it to my buddy list. Any idea how to do that?

-Mousikos
Thanks given by:
#2
step 1 - get the CN IP using WHOIS
2 - retrieve the ip from the console using conline (at $conline ?)
3 -compare the ip with all the ips stored in your list : Loop i (listlen IPlist) [if (strstr (at $IPlist $i) [echo (concat "Buddy" (at $IPlist (+ $i 1)) "is" (getpn CN))] []
4 - make a list of your friends wit their names after ip:
alias IPlist [
x.x.x PERROS
x.x.x BugBoy
x.x.x Draul
and so on ]

in case you want to add IPs to the list ingame: add2list IPlist (concat ...)
Thanks given by:
#3
Usually you have to be admin or mod your client for full ip
Thanks given by:
#4
(20 Apr 14, 11:29PM)Felix-The-Ghost Wrote: Usually you have to be admin or mod your client for full ip

Is that even possible with a client mod? I thought it was server side code. Removing the check client side always uses a 0 as the last octet.
Thanks given by:
#5
I did it in 1.1, I dunno.
Thanks given by:
#6
(20 Apr 14, 11:29PM)Felix-The-Ghost Wrote: or mod your client for full ip

(21 Apr 14, 09:34AM)Felix-The-Ghost Wrote: I did it in 1.1, I dunno.

Mind sharing it? The server doesn't send the octets, but instead wipes it out with a 0 at the end if you do not have access. Client displays any address ending with 0 as a .x iirc.
Thanks given by:
#7
Nothing special, exactly what Phantom mentioned, though for some reason I remember it working (maybe I just interpreted it as that)
Thanks given by:
#8
(21 Apr 14, 03:27PM)Ronald_Reagan Wrote: Client displays any address ending with 0 as a .x iirc.

Actually if i remember correctly it doesn't check for the IP ending with .0, rather it checks to see if the player is admin or not. By removing the condition it does however just show the first 3 octets of the IP with the .0
Thanks given by:
#9
Which in a lot of cases would be true, right? Guess I figured in my < 5 tests that was correctly fetching their port.
Thanks given by:
#10
Probably, I thought it was working on my first several tests as well haha
Thanks given by:
#11
It's just, you can't really do anything with it :P

The worst I can think of is someone flooding someone's IP with data kind of like a DDOS but how would you acquire so much rage to go out of your way with tools to temporarily suspend someone's connection?

I can't even remember why I ever tried it. I probably just saw a line of code that looked like a "quick fix" by a dev and investigated it. AC is full of "hacky" stuff in there.
Thanks given by:
#12
Anyway back on topic, is there not a command to read the IP directly without requiring a whois? Not sure maybe that's in SVN.
Thanks given by:
#13
(21 Apr 14, 05:00PM)PhaNtom Wrote: Anyway back on topic, is there not a command to read the IP directly without requiring a whois? Not sure maybe that's in SVN.

player cn ip
Thanks given by:
#14
(21 Apr 14, 05:57PM)Jpablon Wrote: player cn ip

Thanks, was looking all over the docs for this
Thanks given by:
#15
Mousikos read my thread about buddy list.
Anyway, if it's finished i wanna have it.
Thanks given by:
#16
I've already read it and it's not possible with cubescript. Besides, querying every server for that information is a bit ridiculous. It's better to query the masterserver and I'm not touching that yet.

Also, I'm starting this in about two weeks when school ends so it's not done yet...
Thanks given by:
#17
(21 Apr 14, 04:32PM)PhaNtom Wrote:
(21 Apr 14, 03:27PM)Ronald_Reagan Wrote: Client displays any address ending with 0 as a .x iirc.

Actually if i remember correctly it doesn't check for the IP ending with .0, rather it checks to see if the player is admin or not. By removing the condition it does however just show the first 3 octets of the IP with the .0

No, how else would RK mod his servers to show the full IP to everyone?

Relevant client code:
if(ip[3] != 0 || player1->clientrole==CR_ADMIN)
            // full IP
        else  // censored IP
Thanks given by:
#18
Ah yes you're right, I read that code months ago and only remembered the "player1->clientrole==CR_ADMIN" part.
Thanks given by:
#19
(21 Apr 14, 05:57PM)Jpablon Wrote:
(21 Apr 14, 05:00PM)PhaNtom Wrote: Anyway back on topic, is there not a command to read the IP directly without requiring a whois? Not sure maybe that's in SVN.

player cn ip
Oh. Player command. I read that as playername playercn ip
Thanks given by:
#20
(22 Apr 14, 03:31PM)Ronald_Reagan Wrote: No, how else would RK mod his servers to show the full IP to everyone?

Yes, the gibbed.me servers show a full IP address. As mentioned, doing so is harmless. Need the code?
Thanks given by:
#21
(22 Apr 14, 11:09PM)RandumKiwi Wrote: Need the code?

Yes, that'd be great.
Thanks given by:
#22
(22 Apr 14, 11:25PM)PhaNtom Wrote:
(22 Apr 14, 11:09PM)RandumKiwi Wrote: Need the code?

Yes, that'd be great.

Replace line 2750 of server.cpp with this:
if(clients[i] && clients[i]->clientnum != cl->clientnum)
Thanks given by:
#23
So to do server side code you have to actually do C++ you can't use cubescript? Okay. Got to read stuff now >.>
Thanks given by:
#24
(24 Apr 14, 02:40PM)Mousikos Wrote: So to do server side code you have to actually do C++ you can't use cubescript? Okay. Got to read stuff now >.>

There's a server side Lua mod if you would find that easier.
Thanks given by:
#25
(24 Apr 14, 02:40PM)Mousikos Wrote: So to do server side code you have to actually do C++ you can't use cubescript? Okay. Got to read stuff now >.>

Yes, to make the server give you the full IP address, you either need to be admin - or change the line mentioned and compile.

However, ignoring that... macm gave you the answer to your initial question.
Thanks given by:
#26
(24 Apr 14, 10:21PM)RandumKiwi Wrote:
(24 Apr 14, 02:40PM)Mousikos Wrote: So to do server side code you have to actually do C++ you can't use cubescript? Okay. Got to read stuff now >.>

Yes, to make the server give you the full IP address, you either need to be admin - or change the line mentioned and compile.

However, ignoring that... macm gave you the answer to your initial question.

Heh sorry that was actually a tangent. I want to mod serverside behavior but wasn't sure if i could inject cubescript into the server or if I had to rewrite source code. This is only semi-related to IP address >.>
Thanks given by: