Cookie Posted August 17, 2012 Group: Members Topic Count: 20 Topics Per Day: 0.00 Content Count: 213 Reputation: 109 Joined: 05/21/12 Last Seen: December 27, 2014 Share Posted August 17, 2012 (edited) Attached is the differential. Basically can be used to get the IP of the currently attached player or character name/account ID/char ID specified. Example: @ip$ = getcharip; OR. @ip$ = getcharip("[GM] Cookie"); OR. @aid = 2000000; getcharip(@aid); ... You get the point. If character isn't attached, returns a blank str. Post your opinions. I really don't mind either way if it's added or not. I just thought I'd share. If it's ok, I'll add it to the SVN. Cookie getcharip.patch Edited August 23, 2012 by Maki Added functionality for char/AID ID. Link to comment Share on other sites More sharing options...
Ind Posted August 18, 2012 Group: Members Topic Count: 169 Topics Per Day: 0.03 Content Count: 1260 Reputation: 750 Joined: 11/19/11 Last Seen: April 11, 2013 Share Posted August 18, 2012 as for the patch just something I think would be changeworthy, in if ( (sd = map_nick2sd(script_getstr(st, 2))) != NULL ) it runs a nick check without checking if the argument is a str, i'd say a script_isstring would be of good use there. the code aside, where do you think this would come in to be useful? Link to comment Share on other sites More sharing options...
Kenpachi Posted August 18, 2012 Group: Members Topic Count: 22 Topics Per Day: 0.00 Content Count: 764 Reputation: 220 Joined: 11/14/11 Last Seen: November 19, 2020 Share Posted August 18, 2012 Maybe I'm too sleepy, but why do we need such a command? You can simply do a SQL query to get a characters IP... Link to comment Share on other sites More sharing options...
Arcenciel Posted August 18, 2012 Group: Members Topic Count: 69 Topics Per Day: 0.01 Content Count: 1315 Reputation: 372 Joined: 12/10/11 Last Seen: August 31, 2013 Share Posted August 18, 2012 Maybe I'm too sleepy, but why do we need such a command? You can simply do a SQL query to get a characters IP... Makes it easier for scripting? Link to comment Share on other sites More sharing options...
Cookie Posted August 18, 2012 Group: Members Topic Count: 20 Topics Per Day: 0.00 Content Count: 213 Reputation: 109 Joined: 05/21/12 Last Seen: December 27, 2014 Author Share Posted August 18, 2012 I originally query_sql for the last IP in a script function I made. Just seemed ridiculous. So, I made this. That's all. Thought I would share, however. If anything, it can be a custom download or what-not. Link to comment Share on other sites More sharing options...
Ind Posted August 18, 2012 Group: Members Topic Count: 169 Topics Per Day: 0.03 Content Count: 1260 Reputation: 750 Joined: 11/19/11 Last Seen: April 11, 2013 Share Posted August 18, 2012 I originally query_sql for the last IP in a script function I made. Just seemed ridiculous. So, I made this. That's all. Thought I would share, however. If anything, it can be a custom download or what-not. either way I'm asking because I couldn't think of a place the player ip would be needed script side (whether its a query or this function) Link to comment Share on other sites More sharing options...
Cookie Posted August 18, 2012 Group: Members Topic Count: 20 Topics Per Day: 0.00 Content Count: 213 Reputation: 109 Joined: 05/21/12 Last Seen: December 27, 2014 Author Share Posted August 18, 2012 I originally query_sql for the last IP in a script function I made. Just seemed ridiculous. So, I made this. That's all. Thought I would share, however. If anything, it can be a custom download or what-not. either way I'm asking because I couldn't think of a place the player ip would be needed script side (whether its a query or this function) Oh, maybe it's just me then. I use it all the time for custom events, tracking, et cetera. XD Link to comment Share on other sites More sharing options...
Panallox Posted August 19, 2012 Group: Members Topic Count: 12 Topics Per Day: 0.00 Content Count: 117 Reputation: 169 Joined: 11/10/11 Last Seen: April 10, 2024 Share Posted August 19, 2012 Recommended for a public download, it's useful for retrieving the IP address without the need of an SQL table look-up (given a lot of servers probably run on MyISAM tables, SQL table look-ups would probably be extremely resource intensive), however it's probably not relevant enough to commit as an official script command though. Nice command though. 1 Link to comment Share on other sites More sharing options...
Trojal Posted August 22, 2012 Group: Members Topic Count: 4 Topics Per Day: 0.00 Content Count: 67 Reputation: 75 Joined: 12/18/11 Last Seen: January 28 Share Posted August 22, 2012 For a machine, the 4 byte ip address as an integer is [always?] more useful than the dotted quad string representation... since you can easily apply masks to the bytes which are used [all the time] to search similar IPs or IP spaces. MySQL has a function to convert from integer to dotted quad if you need it, too. Also, strings take up so many more bytes and their internals are just ugly in C. I'm saying this because I see ip2str (which I assume converts the integer to a dotted quad representation, but I didn't really look it up). Link to comment Share on other sites More sharing options...
Euphy Posted November 24, 2012 Group: Members Topic Count: 72 Topics Per Day: 0.02 Content Count: 2997 Reputation: 1132 Joined: 05/27/12 Last Seen: June 1, 2017 Share Posted November 24, 2012 Reviving this topic. It's a small patch and may be useful, so why not? Link to comment Share on other sites More sharing options...
Cookie Posted November 24, 2012 Group: Members Topic Count: 20 Topics Per Day: 0.00 Content Count: 213 Reputation: 109 Joined: 05/21/12 Last Seen: December 27, 2014 Author Share Posted November 24, 2012 Agreed. I'll make a modification to one part of it and add it in after testing. Implemented in r16957. Link to comment Share on other sites More sharing options...
Recommended Posts