Posts: 1,033
Threads: 85
Joined: Oct 2013
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
Posts: 205
Threads: 3
Joined: Jun 2010
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 ...)
Posts: 756
Threads: 53
Joined: Nov 2011
Usually you have to be admin or mod your client for full ip
Posts: 729
Threads: 16
Joined: Dec 2012
(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.
Posts: 756
Threads: 53
Joined: Nov 2011
I did it in 1.1, I dunno.
Posts: 3,462
Threads: 72
Joined: Jun 2010
(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.
Posts: 756
Threads: 53
Joined: Nov 2011
Nothing special, exactly what Phantom mentioned, though for some reason I remember it working (maybe I just interpreted it as that)
Posts: 729
Threads: 16
Joined: Dec 2012
(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
Posts: 756
Threads: 53
Joined: Nov 2011
21 Apr 14, 04:36PM
(This post was last modified: 21 Apr 14, 04:36PM by Felix-The-Ghost.)
Which in a lot of cases would be true, right? Guess I figured in my < 5 tests that was correctly fetching their port.
Posts: 729
Threads: 16
Joined: Dec 2012
Probably, I thought it was working on my first several tests as well haha
Posts: 756
Threads: 53
Joined: Nov 2011
21 Apr 14, 04:52PM
(This post was last modified: 21 Apr 14, 04:54PM by Felix-The-Ghost.)
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.
Posts: 729
Threads: 16
Joined: Dec 2012
21 Apr 14, 05:00PM
(This post was last modified: 21 Apr 14, 05:04PM by PhaNtom.)
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.
Posts: 101
Threads: 2
Joined: Sep 2011
(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
Posts: 729
Threads: 16
Joined: Dec 2012
(21 Apr 14, 05:57PM)Jpablon Wrote: player cn ip
Thanks, was looking all over the docs for this
Posts: 144
Threads: 6
Joined: Apr 2014
Mousikos read my thread about buddy list.
Anyway, if it's finished i wanna have it.
Posts: 1,033
Threads: 85
Joined: Oct 2013
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...
Posts: 3,462
Threads: 72
Joined: Jun 2010
(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
Posts: 729
Threads: 16
Joined: Dec 2012
Ah yes you're right, I read that code months ago and only remembered the "player1->clientrole==CR_ADMIN" part.
Posts: 1,033
Threads: 85
Joined: Oct 2013
22 Apr 14, 04:05PM
(This post was last modified: 22 Apr 14, 04:10PM by Mousikos.)
(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
Posts: 1,039
Threads: 77
Joined: Jun 2010
22 Apr 14, 11:09PM
(This post was last modified: 24 Apr 14, 07:37AM by RandumKiwi.)
(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?
Posts: 729
Threads: 16
Joined: Dec 2012
(22 Apr 14, 11:09PM)RandumKiwi Wrote: Need the code?
Yes, that'd be great.
Posts: 1,039
Threads: 77
Joined: Jun 2010
(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)
Posts: 1,033
Threads: 85
Joined: Oct 2013
So to do server side code you have to actually do C++ you can't use cubescript? Okay. Got to read stuff now >.>
Posts: 729
Threads: 16
Joined: Dec 2012
(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.
Posts: 1,039
Threads: 77
Joined: Jun 2010
(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.
Posts: 1,033
Threads: 85
Joined: Oct 2013
(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 >.>
|