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

Module: GeoIP+ (v1.3)


Post New Thread Reply   
 
Thread Tools Display Modes
.:cs.stambeto:.
Senior Member
Join Date: Feb 2010
Location: Bulgaria
Old 02-06-2015 , 10:25   Re: Module: GeoIP+ (v1.1)
Reply With Quote #171

Why not do it when you can not recognize the city to write so [error] or N/A , as it was in previous versions. For now displayed in chat [] and at least hud visible N/A.

Last edited by .:cs.stambeto:.; 02-06-2015 at 10:28.
.:cs.stambeto:. is online now
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-07-2015 , 10:45   Re: Module: GeoIP+ (v1.1)
Reply With Quote #172

That's coder's job to define how they want to show on failed lookup. That a plugin doesn't deal with the possibility geoip could return no data, is a tip plugin is poorly coded.
That's said to keep compatibility, "error" should be set for "geoip_country'. Will be fixed soon for this one.
__________________
Arkshine is offline
.:cs.stambeto:.
Senior Member
Join Date: Feb 2010
Location: Bulgaria
Old 02-07-2015 , 18:46   Re: Module: GeoIP+ (v1.1)
Reply With Quote #173

Quote:
Originally Posted by Arkshine View Post
That's coder's job to define how they want to show on failed lookup. That a plugin doesn't deal with the possibility geoip could return no data, is a tip plugin is poorly coded.
That's said to keep compatibility, "error" should be set for "geoip_country'. Will be fixed soon for this one.
I tried last update countries when it can not recognize them write N/A on hud if can fix and for city. Also the previous version when you can not recognize any city or state in writing chat [error] if can fix him.
.:cs.stambeto:. is online now
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 02-18-2015 , 06:15   Re: Module: GeoIP+ (v1.1)
Reply With Quote #174

I am using the last update, but it is really inaccurate. This is one output example:


Code:
m.p. has conected from [Denmark][Holstebro]
GiAnNhS has conected from [Greece][Holstebro]
luca knudsen has conected from [Denmark][Holstebro]
crackeN has conected from [Germany][Holstebro]
Renicilin has conected from [Hungary][Budapest]
Muva ^ has conected from [Serbia][Backo Gradiste]
silujem has conected from [Bosnia and Herzegovina][Backo Gradiste]
PHP Code:
new szCountry[32], szCity[32];

public 
plugin_init()
{
    
register_plugin("Country/City Connect""0.1""black-blood");
}

public 
client_putinserver(id)
{
    new 
szName[32], szIP[32];
    
    
get_user_name(idszNamecharsmax(szName))
    
get_user_ip(idszIPcharsmax(szIP), 1)

    
geoip_country(szIPszCountrycharsmax (szCountry))
    
geoip_city(szIPszCitycharsmax(szCity))

    
client_print(0print_chat"%s has conected from [%s][%s]"szNameszCountryszCity); 

Last edited by bLacK-bLooD; 02-18-2015 at 06:16.
bLacK-bLooD is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-18-2015 , 07:00   Re: Module: GeoIP+ (v1.1)
Reply With Quote #175

I'm not sure how I'm supposed to see how it's inaccurate from your example, but I can do nothing on it anyway. Database is provided as it is. It's the lite and free version. It's probably a good idea to update it often, as it seems to be updated each week and since it's a new database format, it's likely it will have more and more data.
__________________

Last edited by Arkshine; 02-18-2015 at 07:04.
Arkshine is offline
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 02-18-2015 , 07:05   Re: Module: GeoIP+ (v1.1)
Reply With Quote #176

Well the examples shows how one city is displayed to more countries. How can Hostelbro be in Denmark, Greece and Germany at the same time?
bLacK-bLooD is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-18-2015 , 08:27   Re: Module: GeoIP+ (v1.1)
Reply With Quote #177

This sounds like a bug. Not sure if from lib API or module. Well it won't hurt to check things.

Actually, this would help if you could test if issue is not from database. Get the ip where city seems wrong, and use the server command: geoip dump <ip> ; it will dump all datas for this IP, and check the "city" entry, if you see the same city name, it's likely a bug with the database, if you see the right name, it means there is some issue with API or module code.
__________________

Last edited by Arkshine; 02-18-2015 at 08:33.
Arkshine is offline
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 02-18-2015 , 09:15   Re: Module: GeoIP+ (v1.1)
Reply With Quote #178

Okay I think I got something.

I tried dumping on a player that had it's location accurate, and I got this JSON output:

Code:
{
    "city": 
      {
        "geoname_id": 
          785482 <uint32>
        "names": 
          {
            "de": 
              "Štip" <utf8_string>
            "en": 
              "Shtip" <utf8_string>
          }
      }
    "continent": 
      {
        "code": 
          "EU" <utf8_string>
        "geoname_id": 
          6255148 <uint32>
        "names": 
          {
            "de": 
              "Europa" <utf8_string>
            "en": 
              "Europe" <utf8_string>
            "es": 
              "Europa" <utf8_string>
            "fr": 
              "Europe" <utf8_string>
            "ja": 
              "ヨーロッパ" <utf8_string>
            "pt-BR": 
              "Europa" <utf8_string>
            "ru": 
              "Европа" <utf8_string>
            "zh-CN": 
              "欧洲" <utf8_string>
          }
      }
    "country": 
      {
        "geoname_id": 
          718075 <uint32>
        "iso_code": 
          "MK" <utf8_string>
        "names": 
          {
            "de": 
              "Ehemalige jugoslawische Republik Mazedonien" <utf8_string>
            "en": 
              "Macedonia" <utf8_string>
            "es": 
              "Macedonia" <utf8_string>
            "fr": 
              "Macédoine" <utf8_string>
            "ja": 
              "マケドニア旧ユーゴスラビア共和国" <utf8_string>
            "pt-BR": 
              "Macedônia" <utf8_string>
            "ru": 
              "Македония" <utf8_string>
            "zh-CN": 
              "前南斯拉夫马其顿共和国" <utf8_string>
          }
      }
    "location": 
      {
        "latitude": 
          41.742300 <double>
        "longitude": 
          22.197900 <double>
        "time_zone": 
          "Europe/Skopje" <utf8_string>
      }
    "registered_country": 
      {
        "geoname_id": 
          718075 <uint32>
        "iso_code": 
          "MK" <utf8_string>
        "names": 
          {
            "de": 
              "Ehemalige jugoslawische Republik Mazedonien" <utf8_string>
            "en": 
              "Macedonia" <utf8_string>
            "es": 
              "Macedonia" <utf8_string>
            "fr": 
              "Macédoine" <utf8_string>
            "ja": 
              "マケドニア旧ユーゴスラビア共和国" <utf8_string>
            "pt-BR": 
              "Macedônia" <utf8_string>
            "ru": 
              "Македония" <utf8_string>
            "zh-CN": 
              "前南斯拉夫马其顿共和国" <utf8_string>
          }
      }
    "subdivisions": 
      [
        {
          "geoname_id": 
            863900 <uint32>
          "iso_code": 
            "70" <utf8_string>
          "names": 
            {
              "en": 
                "Opstina Stip" <utf8_string>
            }
        }
      ]
  }

However when I tried dumping on a player that had a wrong location, this was the JSON output:

Code:
  {
    "continent": 
      {
        "code": 
          "EU" <utf8_string>
        "geoname_id": 
          6255148 <uint32>
        "names": 
          {
            "de": 
              "Europa" <utf8_string>
            "en": 
              "Europe" <utf8_string>
            "es": 
              "Europa" <utf8_string>
            "fr": 
              "Europe" <utf8_string>
            "ja": 
              "ヨーロッパ" <utf8_string>
            "pt-BR": 
              "Europa" <utf8_string>
            "ru": 
              "Европа" <utf8_string>
            "zh-CN": 
              "欧洲" <utf8_string>
          }
      }
    "country": 
      {
        "geoname_id": 
          390903 <uint32>
        "iso_code": 
          "GR" <utf8_string>
        "names": 
          {
            "de": 
              "Griechenland" <utf8_string>
            "en": 
              "Greece" <utf8_string>
            "es": 
              "Grecia" <utf8_string>
            "fr": 
              "Grèce" <utf8_string>
            "ja": 
              "ギリシャ共和国" <utf8_string>
            "pt-BR": 
              "Grécia" <utf8_string>
            "ru": 
              "Греция" <utf8_string>
            "zh-CN": 
              "希腊" <utf8_string>
          }
      }
    "location": 
      {
        "latitude": 
          37.966700 <double>
        "longitude": 
          23.716700 <double>
        "time_zone": 
          "Europe/Athens" <utf8_string>
      }
    "registered_country": 
      {
        "geoname_id": 
          390903 <uint32>
        "iso_code": 
          "GR" <utf8_string>
        "names": 
          {
            "de": 
              "Griechenland" <utf8_string>
            "en": 
              "Greece" <utf8_string>
            "es": 
              "Grecia" <utf8_string>
            "fr": 
              "Grèce" <utf8_string>
            "ja": 
              "ギリシャ共和国" <utf8_string>
            "pt-BR": 
              "Grécia" <utf8_string>
            "ru": 
              "Греция" <utf8_string>
            "zh-CN": 
              "希腊" <utf8_string>
          }
      }
  }
What I can see is that when the city is wrong/unknown, it doesn't output the city key/value pair, so basically there's no data about that city. The strange thing is that the module somehow figures out something is missing and replaces the missing city with a random one.'

Here is another wrong one:

Code:
  {
    "continent": 
      {
        "code": 
          "EU" <utf8_string>
        "geoname_id": 
          6255148 <uint32>
        "names": 
          {
            "de": 
              "Europa" <utf8_string>
            "en": 
              "Europe" <utf8_string>
            "es": 
              "Europa" <utf8_string>
            "fr": 
              "Europe" <utf8_string>
            "ja": 
              "ヨーロッパ" <utf8_string>
            "pt-BR": 
              "Europa" <utf8_string>
            "ru": 
              "Европа" <utf8_string>
            "zh-CN": 
              "欧洲" <utf8_string>
          }
      }
    "country": 
      {
        "geoname_id": 
          3194884 <uint32>
        "iso_code": 
          "ME" <utf8_string>
        "names": 
          {
            "de": 
              "Montenegro" <utf8_string>
            "en": 
              "Montenegro" <utf8_string>
            "es": 
              "Montenegro" <utf8_string>
            "fr": 
              "Monténégro" <utf8_string>
            "ja": 
              "モンテネグロ" <utf8_string>
            "pt-BR": 
              "Montenegro" <utf8_string>
            "ru": 
              "Черногория" <utf8_string>
            "zh-CN": 
              "黑山共和国" <utf8_string>
          }
      }
    "location": 
      {
        "latitude": 
          42.000000 <double>
        "longitude": 
          19.000000 <double>
        "time_zone": 
          "Europe/Podgorica" <utf8_string>
      }
    "registered_country": 
      {
        "geoname_id": 
          3194884 <uint32>
        "iso_code": 
          "ME" <utf8_string>
        "names": 
          {
            "de": 
              "Montenegro" <utf8_string>
            "en": 
              "Montenegro" <utf8_string>
            "es": 
              "Montenegro" <utf8_string>
            "fr": 
              "Monténégro" <utf8_string>
            "ja": 
              "モンテネグロ" <utf8_string>
            "pt-BR": 
              "Montenegro" <utf8_string>
            "ru": 
              "Черногория" <utf8_string>
            "zh-CN": 
              "黑山共和国" <utf8_string>
          }
      }
  }

Last edited by bLacK-bLooD; 02-18-2015 at 09:18.
bLacK-bLooD is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-18-2015 , 09:53   Re: Module: GeoIP+ (v1.1)
Reply With Quote #179

Ah. I think know why and has been already fixed some days ago on amxx repo. Issue is module doesn't set a length to 0 when it should, so what you get is a previous value from buffer.

I have to sync changes from upstream for this module. Wait for an update.
__________________
Arkshine is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-19-2015 , 16:01   Re: Module: GeoIP+ (v1.2)
Reply With Quote #180

Updated to 1.2 from upstream.

Essentially, it fixes a buffer issue with natives, and fix some various compatibility issues.
Check https://forums.alliedmods.net/showth...7215#Changelog for more informations.
__________________

Last edited by Arkshine; 02-19-2015 at 16:01.
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 11:13.


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