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

Module: GeoIP+ (v1.3)


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-27-2009 , 14:24   Re: Module: GeoIP Extended
Reply With Quote #21

Updated.

Quote:
v1.0.1 : [ 27 jun 2009 ]
(+) geoip_distance() can return in Miles now.
(+) geoip_continent_code() returns by default an integer now. The two characters is still passed but as optional param.
__________________
Arkshine is offline
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 06-27-2009 , 14:29   Re: Module: GeoIP Extended
Reply With Quote #22

Quote:
Originally Posted by arkshine View Post
Since I suck in english, I have some difficulty with the .inc.
"(to) look up", lookup is used for words like "lookup table" though. but you should wait for some native speaker like exolent.
__________________
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-27-2009 , 14:57   Re: Module: GeoIP Extended
Reply With Quote #23

Code:
/**
* Look up the continent code for a given IP address.
*
* @note The code can be retrieved as an integer or string (2 characters).
* @note Possible continent codes are AF, AS, EU, NA, OC, SA for * Africa(1), Asia(2), Europe(3), North America(4), Oceania(5) and South America(6). *
* @param ip        The IP address to look up.
* @param result    The result of the geoip lookup. This param is optional. *                  If the lookup does not succeed, the buffer is not modified. * @return          The result of the geoip lookup, 0 on a failed lookup. */ enum Continent {     AFRICA = 1,     ASIA,     EUROPE,     NORTH_AMERICA,     OCEANIA,     SOUTH_AMERICA } native Continent:geoip_continent_code( const ip[], result[3] = "" );

I also suggest something like:
Code:
enum Continent {     CONTINENT_ERROR = 0,     AFRICA,     ASIA,     EUROPE,     NORTH_AMERICA,     OCEANIA,     SOUTH_AMERICA }

Then when you write code for it, you can do:
Code:
new const g_szContinentNames[Continent][] = {     "",     "Africa",     "Asia",     "Europe",     "North America",     "Oceania",     "South America" }; // ... new szIp[32]; get_user_ip(iPlayer, szIp, 31, 1); new Continent:iCont = geoip_continent_code(szIp); if( iCont == CONTINENT_ERROR ) {     client_print(client, print_chat, "You could not be found on the Earth!"); } else {     client_print(client, print_chat, "You are from %s? Awesome!", g_szContinentNames[iCont]); }

It would have more readability.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-27-2009 , 15:02   Re: Module: GeoIP Extended (v1.0.1)
Reply With Quote #24

I agree. Thanks ! And updated.
__________________
Arkshine is offline
diamond-optic
Veteran Member
Join Date: May 2005
Location: Upstate New York
Old 06-27-2009 , 15:22   Re: Module: GeoIP Extended (v1.0.1)
Reply With Quote #25

any specific reason why the linux binary is named differently now?
__________________
diamond-optic is offline
Send a message via AIM to diamond-optic
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-27-2009 , 15:44   Re: Module: GeoIP Extended (v1.0.1)
Reply With Quote #26

Oops I forgot to rename.

EDIT: Done. Thanks.
__________________

Last edited by Arkshine; 06-27-2009 at 15:47.
Arkshine is offline
diamond-optic
Veteran Member
Join Date: May 2005
Location: Upstate New York
Old 06-27-2009 , 16:01   Re: Module: GeoIP Extended (v1.0.1)
Reply With Quote #27

ok i found an IP that cuases crashing...

98.154.81.146


if you try to get the region of that IP, it crashes the server



finding country is fine, city gives error.. so im thinking maybe if i check for the error on the city lookup and skip the region lookup if it gives 'error' result, i might be able to avoid the crashing.. gonna do some testing and find some more IPs that give this problem tho
__________________
diamond-optic is offline
Send a message via AIM to diamond-optic
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-27-2009 , 16:29   Re: Module: GeoIP Extended (v1.0.1)
Reply With Quote #28

Woh. It's weird. Oo I'm trying to debug...
__________________
Arkshine is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-27-2009 , 18:00   Re: Module: GeoIP Extended (v1.0.1)
Reply With Quote #29

Ok, after some debug, it's the GeoIPCity.dat file fault. It seems that there are no data for region and city for this ip. But it's weird because latitude and longitude exist..

so in :

Code:
if ( rec )
{
	MF_SetAmxString( amx, params[2], rec->region, 2 );
	return 1;
}
rec is valid but rec->region is not initiliazed because of null and MF_SetAmxString() seems to not like null string.
So as fix, adding "&& rec->region" should be fine.

I'm going to test and I will update here ASAP.
__________________
Arkshine is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-28-2009 , 04:11   Re: Module: GeoIP Extended (v1.0.2)
Reply With Quote #30

Updated.

Quote:
v1.0.2 : [ 28 jun 2009 ]
(!) Fixed possible crash when no data is available from GeoIPCity.dat file for a given IP address.
__________________

Last edited by Arkshine; 06-28-2009 at 04:19.
Arkshine is offline
Old 06-28-2009, 04:17
Arkshine
This message has been deleted by Arkshine. Reason: Lag.
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 10:08.


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