AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [ANY] GeoIP2 (https://forums.alliedmods.net/showthread.php?t=311477)

Accelerator 10-19-2018 04:45

[ANY] GeoIP2
 
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

ThatKidWhoGames 10-19-2018 10:03

Re: [ANY] GeoIP2
 
Thanks for this!!

Bacardi 10-19-2018 10:32

Re: [ANY] GeoIP2
 
Nice work OP.

Maxximou5 10-19-2018 16:08

Re: [ANY] GeoIP2
 
Excellent!

Accelerator 10-20-2018 09:18

Re: [ANY] GeoIP2
 
Updated.

v1.1.0:
- Code optimization
- New natives

Bacardi 11-16-2018 07:43

Re: [ANY] GeoIP2
 
Here some news

https://github.com/alliedmodders/sourcemod/pull/914

scorpius2k1 12-20-2019 16:27

Re: [ANY] GeoIP2
 
Thanks for this OP!

Quote:

Originally Posted by Bacardi (Post 2624274)

I haven't had any issues with Accelerator74's extension, works great. However, are there any updates on the SourceMod side of things or are we stuck using outdated GeoIP databases if not using this extention?

Apologies for the thread necro.

Thanks!

freak.exe_uLow 01-30-2020 14:31

Re: [ANY] GeoIP2
 
Hey Accelerator74, it is no longer possible to download the files "GeoLite2-City.mmdb and GeoLite2-Country.mmdb ".

Accelerator 01-30-2020 14:40

Re: [ANY] GeoIP2
 
Register on maxmind to be able to download new databases

freak.exe_uLow 03-08-2020 18:21

Re: [ANY] GeoIP2
 
Quote:

Originally Posted by Accelerator74 (Post 2682208)
Register on maxmind to be able to download new databases

Itīs little bit late but thanks :3


All times are GMT -4. The time now is 07:15.

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