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

[ANY] SxGeo


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Accelerator
Senior Member
Join Date: Dec 2010
Location: Russia
Old 10-15-2018 , 06:36   [ANY] SxGeo
Reply With Quote #1

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
__________________

Last edited by Accelerator; 10-15-2018 at 13:51.
Accelerator is offline
dark_angel
New Member
Join Date: May 2020
Old 05-25-2020 , 02:36   Re: [ANY] SxGeo
Reply With Quote #2

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
dark_angel is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-25-2020 , 12:47   Re: [ANY] SxGeo
Reply With Quote #3

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++ ?
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
dark_angel
New Member
Join Date: May 2020
Old 05-25-2020 , 13:49   Re: [ANY] SxGeo
Reply With Quote #4

Quote:
Originally Posted by Accelerator74 View Post
Sourcemod extension, using Sypex Geo API.

Update : Just now tried version 1.0.0 and it works fine
dark_angel is offline
Gold Fish
Senior Member
Join Date: Mar 2020
Old 02-02-2022 , 03:34   Re: [ANY] SxGeo
Reply With Quote #5

Is this plugin better than geoip2 ?
__________________
-

PHP Code:
public OnClientConnect(int Client) {
    
KickClient(Client"sorry");


Last edited by Gold Fish; 02-02-2022 at 03:34.
Gold Fish is offline
Accelerator
Senior Member
Join Date: Dec 2010
Location: Russia
Old 02-02-2022 , 04:18   Re: [ANY] SxGeo
Reply With Quote #6

They are just different bases. I would recommend using GeoIP2, it provides more options.
__________________
Accelerator is offline
Reply


Thread Tools
Display Modes

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 12:36.


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