Raised This Month: $51 Target: $400
 12% 

[ANY] GeoIP2


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Accelerator
Senior Member
Join Date: Dec 2010
Location: Russia
Old 10-19-2018 , 04:45   [ANY] GeoIP2
Reply With Quote #1

GeoIP2 is now included with SourceMod 1.11.6703.

This is a rewritten geoip extension from the SourceMod distribution for the new database format from MaxMind .mmdb.

Installation:
  • Download latest release version.
  • Extract all files from the archive with replacement to your game server.
  • Download last database GeoLite2-City.mmdb or GeoLite2-Country.mmdb and put to path addons/sourcemod/configs/geoip/
  • Recompile all plugins that use geoip.inc.

Usage:
PHP Code:
// geoip.inc

/**
 * @section IP addresses can contain ports, the ports will be stripped out.
 */

/**
 * Gets the two character country code from an IP address. (US, CA, etc)
 *
 * @param ip            Ip to determine the country code.
 * @param ccode            Destination string buffer to store the code.
 * @return                True on success, false if no country found.
 */
native bool GeoipCode2(const char[] ipchar ccode[3]);

/**
 * Gets the three character country code from an IP address. (USA, CAN, etc)
 *
 * @param ip            Ip to determine the country code.
 * @param ccode            Destination string buffer to store the code.
 * @return                True on success, false if no country found.
 */
native bool GeoipCode3(const char[] ipchar ccode[4]);

/**
 * Gets the two character continent code from an IP address. (EU, AS, etc)
 *
 * @param ip            Ip to determine the continent code.
 * @param ccode            Destination string buffer to store the code.
 * @return                True on success, false if no continent found.
 */
native bool GeoipContinentCode(const char[] ipchar ccode[3]);

/**
 * Gets the two/three region code from an IP address. (IL, CHE, etc)
 *
 * @param ip            Ip to determine the region code.
 * @param ccode            Destination string buffer to store the code.
 * @return                True on success, false if no region found.
 */
native bool GeoipRegionCode(const char[] ipchar ccode[4]);

/**
 * Gets the timezone. (max length of output string is 45)
 *
 * @param ip            Ip to determine the timezone.
 * @param name            Destination string buffer to store the timezone.
 * @param maxlength            Maximum length of output string buffer.
 * @return                True on success, false if no timezone found.
 */
native bool GeoipTimezone(const char[] ipchar[] nameint maxlength);

/**
 * Gets the full country name. (max length of output string is 45)
 *
 * @param ip            Ip to determine the country code.
 * @param name            Destination string buffer to store the country name.
 * @param maxlength            Maximum length of output string buffer.
 * @param lang            Which language to the output of result the geoip2 lookup.
 * @return                True on success, false if no country found.
 */
native bool GeoipCountry(const char[] ipchar[] nameint maxlength, const char[] lang "en");

/**
 * Gets the full continent name. (max length of output string is 45)
 *
 * @param ip            Ip to determine the continent code.
 * @param name            Destination string buffer to store the continent name.
 * @param maxlength            Maximum length of output string buffer.
 * @param lang            Which language to the output of result the geoip2 lookup.
 * @return                True on success, false if no continent found.
 */
native bool GeoipContinent(const char[] ipchar[] nameint maxlength, const char[] lang "en");

/**
 * Gets the full region name. (max length of output string is 45)
 *
 * @param ip            Ip to determine the region code.
 * @param name            Destination string buffer to store the region name.
 * @param maxlength            Maximum length of output string buffer.
 * @param lang            Which language to the output of result the geoip2 lookup.
 * @return                True on success, false if no region found.
 */
native bool GeoipRegion(const char[] ipchar[] nameint maxlength, const char[] lang "en");

/**
 * Gets the city name. (max length of output string is 45)
 *
 * @param ip            Ip to determine the city code.
 * @param name            Destination string buffer to store the city name.
 * @param maxlength            Maximum length of output string buffer.
 * @param lang            Which language to the output of result the geoip2 lookup.
 * @return                True on success, false if no city found.
 */
native bool GeoipCity(const char[] ipchar[] nameint maxlength, const char[] lang "en"); 
Download: https://github.com/Accelerator74/GeoIP2/releases
__________________

Last edited by Accelerator; 02-02-2022 at 04:20.
Accelerator is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode