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

Module: GeoIP+ (v1.3)


Post New Thread Reply   
 
Thread Tools Display Modes
l33tcso
New Member
Join Date: Dec 2015
Old 12-18-2015 , 10:13   Re: Module: GeoIP+ (v1.2)
Reply With Quote #191

Quote:
Originally Posted by Arkshine View Post
@l33tcso: In geoip.inc, comment any lines starting with #pragma. Forgot the remove them.

Please do it...

PHP Code:
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
//     https://alliedmods.net/amxmodx-license

//
// GeoIP Module Functions
//

#if defined geoip_included
    #endinput
#endif
#define _geoip_included

#if AMXX_VERSION_NUM >= 175
    #pragma reqlib geoip
    #if !defined AMXMODX_NOAUTOLOAD
        #pragma loadlib geoip
    #endif
#else
    #pragma library geoip
#endif

/**
 * @global  IP addresses passed to these natives can contain ports, the ports will be ignored.
 */

/**
 * Look up the two character country code for a given IP address.
 * e.g: "US", "CA", etc.
 *
 * @param ip        The IP address to lookup.
 * @param result    The result buffer.  If the lookup does not succeed, the buffer is not modified.
 *
 * @return          true on a successful lookup, false on a failed lookup.
 */
native bool:geoip_code2_ex(const ip[], result[3]);

/**
 * Look up the three character country code for a given IP address.
 * e.g: "USA", "cAN", etc.
 *
 * @param ip        The IP address to lookup.
 * @param result    The result buffer.  If the lookup does not succeed, the buffer is not modified.
 *
 * @return          true on a successful lookup, false on a failed lookup.
 */
native bool:geoip_code3_ex(const ip[], result[4]);

/**
 * Lookup the two character country code for a given IP address. Sets the buffer to "error" on
 * an unsuccessful lookup.
 *
 * @deprecated  This native will overflow the buffer by one cell on an unknown ip lookup!
 *              Use geoip_code2_ex instead.
 *
 * @param ip        The IP address to lookup.
 * @param result    The result buffer.
 *
 * @return          The result length.
 */
#pragma deprecated Use geoip_code2_ex() instead.
native geoip_code2(const ip[], ccode[3]);

/**
 * Lookup the three character country code for a given IP address. Sets the buffer to "error" on
 * an unsuccessful lookup.
 *
 * @deprecated  This native will overflow the buffer by one cell on an unknown ip lookup!
 *              Use geoip_code3_ex instead.
 *
 * @param ip        The IP address to lookup.
 * @param result    The result buffer.
 *
 * @return          The result length.
 */
#pragma deprecated Use geoip_code3_ex() instead.
native geoip_code3(const ip[], result[4]);

/**
 * Lookup the full country name for the given IP address.  Sets the buffer to "error" on
 * an unsuccessful lookup.
 *
 * @param ip        The IP address to lookup.
 * @param result    The result of the geoip lookup.
 * @param len       The maximum length of the result buffer.
 *
 * @return          The result length.
 */
#pragma deprecated Use geoip_country_ex() instead.
native geoip_country(const ip[], result[], len 45);

/**
 * Lookup the full country name for the given IP address.
 *
 * @param ip        The IP address to lookup.
 * @param result    The result of the geoip lookup.
 * @param len       The maximum length of the result buffer.
 * @param id        An optional player's index in order to return the result
 *                  in the player's language, if supported.
 *                  -1: the default language, which is english.
 *                   0: the server language. You can use LANG_SERVER define.
 *                 >=1: the player's language.
 *
 * @return          The result length on successful lookup, 0 otherwise.
 */
native geoip_country_ex(const ip[], result[], lenid = -1);

/**
 * Look up the full city name for the given IP address.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @param ip        The IP address to look up.
 * @param result    The result of the geoip look up.
 * @param len       The maximum length of the result buffer.
 * @param id        An optional player's index in order to return the result
 *                  in the player's language, if supported.
 *                  -1: the default language, which is english.
 *                   0: the server language. You can use LANG_SERVER define.
 *                 >=1: the player's language.
 *
 * @return          The result length on successful lookup, 0 otherwise.
 */
native geoip_city(const ip[], result[], lenid = -1);

/**
 * Look up the region/state code for the given IP address.
 * e.g. "US-OH", "DE-HH", IT-82, "FR-U", etc.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @param ip        The IP address to look up.
 * @param result    The result of the geoip look up.
 * @param len       The maximum length of the result buffer.
 *
 * @return          The result length on successful lookup, 0 otherwise.
 */
native geoip_region_code(const ip[], result[], len);

/**
 * Look up the full region/state name for the given IP address.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @param ip        The IP address to look up.
 * @param result    The result of the geoip look up.
 * @param len       The maximum length of the result buffer.
 * @param id        An optional player's index in order to return the result
 *                  in the player's language, if supported.
 *                  -1: the default language, which is english.
 *                   0: the server language. You can use LANG_SERVER define.
 *                 >=1: the player's language.
 *
 * @return          The result length on successful lookup, 0 otherwise.
 */
native geoip_region_name(const ip[], result[], lenid = -1);

/**
 * Look up the full time zone for the given IP address.
 * e.g. America/Los_Angeles, Europe/Paris.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @param ip        The IP address to look up.
 * @param result    The result of the geoip look up.
 * @param len       The maximum length of the result buffer.
 *
 * @return          The result length on successful lookup, 0 otherwise.
 */
native geoip_timezone(const ip[], result[], len);

/**
 * Look up the city's latitude for the given IP address.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @param ip        The IP address to look up.
 *
 * @return          The result of the geoip look up, 0 if latitude is not found.
 */
native Float:geoip_latitude(const ip[]);

/**
 * Look up the city's longitude for the given IP address.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @param ip        The IP address to look up.
 *
 * @return          The result of the geoip look up, 0 if longitude is not found.
 */
native Float:geoip_longitude(const ip[]);

/**
 * Calculate the distance between geographical coordinates, latitude and longitude.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @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:geoip_distance(Float:lat1Float:lon1Float:lat2Float:lon2system SYSTEM_METRIC);

/**
 * Look up the continent code for a given IP address.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 * @note  The code can be retrieved as integer (See CONTINENT_* constants.) or string (2 characters).
 * @note  Possible continent codes are AF, AN, AS, EU, NA, OC, SA for
 *        Africa(1), Antarctica(2), Asia(3), Europe(4), North America(5), Oceania(6), South America(7).
 *
 * @param ip        The IP address to look up.
 * @param result    The result of the geoip look up.
 *
 * @return          The continent id on successful lookup, 0 otherwise.
 */
enum Continent
{
    
CONTINENT_UNKNOWN 0,
    
CONTINENT_AFRICA,
    
CONTINENT_ANTARCTICA,
    
CONTINENT_ASIA,
    
CONTINENT_EUROPE,
    
CONTINENT_NORTH_AMERICA,
    
CONTINENT_OCEANIA,
    
CONTINENT_SOUTH_AMERICA,
};
native Continent:geoip_continent_code(const ip[], result[3]);

/**
 * Look up the full continent name for the given IP address.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @param ip        The IP address to look up.
 * @param result    The result of the geoip look up.
 * @param len       The maximum length of the result buffer.
 * @param id        An optional player's index in order to return the result
 *                  in the player's language, if supported.
 *                  -1: the default language, which is english.
 *                   0: the server language. You can use LANG_SERVER define.
 *                 >=1: the player's language.
 *
 * @return          The result length on successful lookup, 0 otherwise.
 */
native geoip_continent_name(const ip[], result[], lenid = -1); 
__________________
Couter-Strike
l33tcso is offline
Send a message via Skype™ to l33tcso
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-18-2015 , 22:19   Re: Module: GeoIP+ (v1.2)
Reply With Quote #192

Try below:
Code:
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
//     https://alliedmods.net/amxmodx-license

//
// GeoIP Module Functions
//

#if defined geoip_included
    #endinput
#endif
#define _geoip_included

#if AMXX_VERSION_NUM >= 175
    #pragma reqlib geoip
    #if !defined AMXMODX_NOAUTOLOAD
        #pragma loadlib geoip
    #endif
#else
    #pragma library geoip
#endif

/**
 * @global  IP addresses passed to these natives can contain ports, the ports will be ignored.
 */

/**
 * Look up the two character country code for a given IP address.
 * e.g: "US", "CA", etc.
 *
 * @param ip        The IP address to lookup.
 * @param result    The result buffer.  If the lookup does not succeed, the buffer is not modified.
 *
 * @return          true on a successful lookup, false on a failed lookup.
 */
native bool:geoip_code2_ex(const ip[], result[3]);

/**
 * Look up the three character country code for a given IP address.
 * e.g: "USA", "cAN", etc.
 *
 * @param ip        The IP address to lookup.
 * @param result    The result buffer.  If the lookup does not succeed, the buffer is not modified.
 *
 * @return          true on a successful lookup, false on a failed lookup.
 */
native bool:geoip_code3_ex(const ip[], result[4]);

/**
 * Lookup the two character country code for a given IP address. Sets the buffer to "error" on
 * an unsuccessful lookup.
 *
 * @deprecated  This native will overflow the buffer by one cell on an unknown ip lookup!
 *              Use geoip_code2_ex instead.
 *
 * @param ip        The IP address to lookup.
 * @param result    The result buffer.
 *
 * @return          The result length.
 */
// #pragma deprecated Use geoip_code2_ex() instead.
native geoip_code2(const ip[], ccode[3]);

/**
 * Lookup the three character country code for a given IP address. Sets the buffer to "error" on
 * an unsuccessful lookup.
 *
 * @deprecated  This native will overflow the buffer by one cell on an unknown ip lookup!
 *              Use geoip_code3_ex instead.
 *
 * @param ip        The IP address to lookup.
 * @param result    The result buffer.
 *
 * @return          The result length.
 */
// #pragma deprecated Use geoip_code3_ex() instead.
native geoip_code3(const ip[], result[4]);

/**
 * Lookup the full country name for the given IP address.  Sets the buffer to "error" on
 * an unsuccessful lookup.
 *
 * @param ip        The IP address to lookup.
 * @param result    The result of the geoip lookup.
 * @param len       The maximum length of the result buffer.
 *
 * @return          The result length.
 */
// #pragma deprecated Use geoip_country_ex() instead.
native geoip_country(const ip[], result[], len = 45);

/**
 * Lookup the full country name for the given IP address.
 *
 * @param ip        The IP address to lookup.
 * @param result    The result of the geoip lookup.
 * @param len       The maximum length of the result buffer.
 * @param id        An optional player's index in order to return the result
 *                  in the player's language, if supported.
 *                  -1: the default language, which is english.
 *                   0: the server language. You can use LANG_SERVER define.
 *                 >=1: the player's language.
 *
 * @return          The result length on successful lookup, 0 otherwise.
 */
native geoip_country_ex(const ip[], result[], len, id = -1);

/**
 * Look up the full city name for the given IP address.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @param ip        The IP address to look up.
 * @param result    The result of the geoip look up.
 * @param len       The maximum length of the result buffer.
 * @param id        An optional player's index in order to return the result
 *                  in the player's language, if supported.
 *                  -1: the default language, which is english.
 *                   0: the server language. You can use LANG_SERVER define.
 *                 >=1: the player's language.
 *
 * @return          The result length on successful lookup, 0 otherwise.
 */
native geoip_city(const ip[], result[], len, id = -1);

/**
 * Look up the region/state code for the given IP address.
 * e.g. "US-OH", "DE-HH", IT-82, "FR-U", etc.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @param ip        The IP address to look up.
 * @param result    The result of the geoip look up.
 * @param len       The maximum length of the result buffer.
 *
 * @return          The result length on successful lookup, 0 otherwise.
 */
native geoip_region_code(const ip[], result[], len);

/**
 * Look up the full region/state name for the given IP address.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @param ip        The IP address to look up.
 * @param result    The result of the geoip look up.
 * @param len       The maximum length of the result buffer.
 * @param id        An optional player's index in order to return the result
 *                  in the player's language, if supported.
 *                  -1: the default language, which is english.
 *                   0: the server language. You can use LANG_SERVER define.
 *                 >=1: the player's language.
 *
 * @return          The result length on successful lookup, 0 otherwise.
 */
native geoip_region_name(const ip[], result[], len, id = -1);

/**
 * Look up the full time zone for the given IP address.
 * e.g. America/Los_Angeles, Europe/Paris.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @param ip        The IP address to look up.
 * @param result    The result of the geoip look up.
 * @param len       The maximum length of the result buffer.
 *
 * @return          The result length on successful lookup, 0 otherwise.
 */
native geoip_timezone(const ip[], result[], len);

/**
 * Look up the city's latitude for the given IP address.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @param ip        The IP address to look up.
 *
 * @return          The result of the geoip look up, 0 if latitude is not found.
 */
native Float:geoip_latitude(const ip[]);

/**
 * Look up the city's longitude for the given IP address.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @param ip        The IP address to look up.
 *
 * @return          The result of the geoip look up, 0 if longitude is not found.
 */
native Float:geoip_longitude(const ip[]);

/**
 * Calculate the distance between geographical coordinates, latitude and longitude.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @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:geoip_distance(Float:lat1, Float:lon1, Float:lat2, Float:lon2, system = SYSTEM_METRIC);

/**
 * Look up the continent code for a given IP address.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 * @note  The code can be retrieved as integer (See CONTINENT_* constants.) or string (2 characters).
 * @note  Possible continent codes are AF, AN, AS, EU, NA, OC, SA for
 *        Africa(1), Antarctica(2), Asia(3), Europe(4), North America(5), Oceania(6), South America(7).
 *
 * @param ip        The IP address to look up.
 * @param result    The result of the geoip look up.
 *
 * @return          The continent id on successful lookup, 0 otherwise.
 */
enum Continent
{
    CONTINENT_UNKNOWN = 0,
    CONTINENT_AFRICA,
    CONTINENT_ANTARCTICA,
    CONTINENT_ASIA,
    CONTINENT_EUROPE,
    CONTINENT_NORTH_AMERICA,
    CONTINENT_OCEANIA,
    CONTINENT_SOUTH_AMERICA,
};
native Continent:geoip_continent_code(const ip[], result[3]);

/**
 * Look up the full continent name for the given IP address.
 *
 * @note  This native requires GeoIP City database, which can be retrieved from:
 *        http://dev.maxmind.com/geoip/geoip2/geolite2/ (MaxMind DB binary)
 *
 * @param ip        The IP address to look up.
 * @param result    The result of the geoip look up.
 * @param len       The maximum length of the result buffer.
 * @param id        An optional player's index in order to return the result
 *                  in the player's language, if supported.
 *                  -1: the default language, which is english.
 *                   0: the server language. You can use LANG_SERVER define.
 *                 >=1: the player's language.
 *
 * @return          The result length on successful lookup, 0 otherwise.
 */
native geoip_continent_name(const ip[], result[], len, id = -1);
zmd94 is offline
ZdubZ0r
Senior Member
Join Date: Feb 2011
Location: Romania
Old 04-28-2016 , 04:51   Re: Module: GeoIP+ (v1.2)
Reply With Quote #193

My module isnt working.... no matter if i enabled and did everything as you guys said.. it ISNT WORKING
Spoiler
ZdubZ0r is offline
Send a message via Yahoo to ZdubZ0r Send a message via Skype™ to ZdubZ0r
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-28-2016 , 05:38   Re: Module: GeoIP+ (v1.2)
Reply With Quote #194

Please show output of the following server commands:

meta list
amxx modules
amxx list

If you're using client console:

amx_showrcon meta list
amx_showrcon amxx modules
amx_showrcon amxx list

Also, what did you do exactly yo install the module?
__________________

Last edited by Arkshine; 04-28-2016 at 05:38.
Arkshine is offline
ZdubZ0r
Senior Member
Join Date: Feb 2011
Location: Romania
Old 04-28-2016 , 06:27   Re: Module: GeoIP+ (v1.2)
Reply With Quote #195

I copied this, GeoLite2 City , GeoLite2-Country, in addons/amxmodx/data/ without renaming them in any way!
Then i took away the ; from geoip in configs/modules.ini
At geoip it says bad load... i dont know why .....

Last edited by ZdubZ0r; 04-28-2016 at 06:30.
ZdubZ0r is offline
Send a message via Yahoo to ZdubZ0r Send a message via Skype™ to ZdubZ0r
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-28-2016 , 06:52   Re: Module: GeoIP+ (v1.2)
Reply With Quote #196

You did not answer fully what I've ashed. This error is usually you're missing the module in /modules.
__________________
Arkshine is offline
ZdubZ0r
Senior Member
Join Date: Feb 2011
Location: Romania
Old 04-28-2016 , 07:04   Re: Module: GeoIP+ (v1.2)
Reply With Quote #197

Spoiler

Spoiler

Spoiler

Last edited by ZdubZ0r; 04-28-2016 at 07:05.
ZdubZ0r is offline
Send a message via Yahoo to ZdubZ0r Send a message via Skype™ to ZdubZ0r
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-30-2016 , 08:49   Re: Module: GeoIP+ (v1.2)
Reply With Quote #198

Are you sure you did copy the module binary in modules?
__________________
Arkshine is offline
ZdubZ0r
Senior Member
Join Date: Feb 2011
Location: Romania
Old 04-30-2016 , 09:05   Re: Module: GeoIP+ (v1.2)
Reply With Quote #199

Yes i did and it didnt worked....
ZdubZ0r is offline
Send a message via Yahoo to ZdubZ0r Send a message via Skype™ to ZdubZ0r
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-30-2016 , 12:53   Re: Module: GeoIP+ (v1.2)
Reply With Quote #200

It's not like I don't trust you, but when you declare it in modules.ini, you get a bad load either the module could not be loaded (a real error, like it fails to load specifically under your system), or file doesn't exist in /modules directory.

You can try to set in server.cfg:

log on
meta_debug 8

EDIT: After setting cvars, try first : meta load geoip_amxx_i386.so
Then stop/start your server, then change the map, and paste here the server log from the start. It should give some message if a module could not be loaded or doesn't exist.
__________________

Last edited by Arkshine; 04-30-2016 at 13:00.
Arkshine is offline
Reply



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 03:40.


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