AlliedModders

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

Accelerator 10-15-2018 06:36

[ANY] SxGeo
 
SxGeo

Sourcemod extension, using Sypex Geo API.

Installation:
  • Download the free version of the SxGeoCity database. Click: SxGeoCity.dat
  • Extract it to /addons/sourcemod/configs/geoip/
  • Extract file sxgeo.ext.so to folder addons/sourcemod/extensions; Extract file sxgeo.inc to folder addons/sourcemod/scripting/include.
  • Install any sm-plugin that requires the sxgeo extension.

Usage:
PHP Code:

// sxgeo.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 SxGeoCode(const char[] ipchar ccode[3]);

/**
 * Gets the full country name.
 *
 * @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 sxgeo lookup.
 *                   Supported languages:
 *                   "ru", "en"
 *
 * @return                True on success, false if no country found.
 */
native bool SxGeoCountry(const char[] ipchar[] nameint maxlength, const char[] lang "en");

/**
 * Gets the city name.
 *
 * @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 sxgeo lookup.
 *                   Supported languages:
 *                   "ru", "en"
 *
 * @return                True on success, false if no city found.
 */
native bool SxGeoCity(const char[] ipchar[] nameint maxlength, const char[] lang "en");

/**
 * Gets the full region name.
 *
 * @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 sxgeo lookup.
 *                   Supported languages:
 *                   "ru", "en"
 *
 * @return                True on success, false if no region found.
 */
native bool SxGeoRegion(const char[] ipchar[] nameint maxlength, const char[] lang "en");

/**
 * Gets the city's latitude
 *
 * @param ip            Ip to determine the city latitude.
 * @return                The result of the latitude, 0 if latitude is not found
 */
native float SxGeoLatitude(const char[] ip);

/**
 * Gets the city's longitude
 *
 * @param ip            Ip to determine the city longitude.
 * @return                The result of the longitude, 0 if longitude is not found
 */
native float SxGeoLongitude(const char[] ip);

/*
 * Calculate the distance between geographical coordinates, latitude and longitude.
 *
 * @param lat1       The first IP latitude.
 * @param lon1       The first IP longitude.
 * @param lat2       The second IP latitude.
 * @param lon2       The second IP longitude.
 * @param system     The system of measurement, 0 = Metric(kilometers) or 1 = English(miles).
 *
 * @return           The distance as result in specified system of measurement.
 */

#define SYSTEM_METRIC   0 // kilometers
#define SYSTEM_IMPERIAL 1 // statute miles

native float SxGeoDistance(float lat1float lon1float lat2float lon2system SYSTEM_METRIC); 

Download: https://github.com/Accelerator74/SxGeo/releases

dark_angel 05-25-2020 02:36

Re: [ANY] SxGeo
 
Getting error

[SM] Extension sxgeo.ext.so failed to load: /root/cssob/cstrike/addons/sourcemod/extensions/sxgeo.ext.so: undefined symbol: _ZTVSt9basic_iosIcSt11char_traitsIcEE



Css v91 Server running on Debian 8.7 with latest sm 1.10


Any help would be appreciated

GeoIP2 is working fine for me, Just wanted to test this

claudiuhks 05-25-2020 12:47

Re: [ANY] SxGeo
 
Code:

***********************************************************
**                                                      **
* SourceBans RCON console                                *
* Type your comand in the box below and hit enter        *
* Type 'clr' to clear the console                        *
**                                                      **
***********************************************************

-> sm exts load sxgeo
[SM] Extension sxgeo.ext.so failed to load: /home/vuser114/Steam/steamapps/common/Counter-Strike Global Offensive Beta - Dedicated Server/csgo/addons/sourcemod/extensions/sxgeo.ext.so: undefined symbol: _ZTVSt9basic_iosIcSt11char_traitsIcEE

Can you compile it in C only ? Without C++ ?

dark_angel 05-25-2020 13:49

Re: [ANY] SxGeo
 
Quote:

Originally Posted by Accelerator74 (Post 2619808)
Sourcemod extension, using Sypex Geo API.


Update : Just now tried version 1.0.0 and it works fine

Gold Fish 02-02-2022 03:34

Re: [ANY] SxGeo
 
Is this plugin better than geoip2 ?

Accelerator 02-02-2022 04:18

Re: [ANY] SxGeo
 
They are just different bases. I would recommend using GeoIP2, it provides more options.


All times are GMT -4. The time now is 14:40.

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