Closed OciXCrom closed 4 years ago
Also notice how
geoip_country
andgeoip_country_ex
give a different value when they can't detect the country. This can be a problem in some cases.
You can check return value of geoip_country_ex
call:
@return The result length on successful lookup, 0 otherwise.
I usually do checks like that by doing if(szCountry[0])
because the country is already stored in some global variable. This check won't give the same result on both functions. Not a big deal, but I think it would be better if they both did the same thing on failure.
geoip_country
is deprecated, you should not use it.
To test an IP you can also use the command geoip dump <ip>
.
Will check if the last updates did something wrong.
@OciXCrom Try to download the latest version of the database. It might be possible that the file you have is corrupted or the structure has changed a little and doesn't work well with the latest lib version. It worked for me it would seem.
I tried using the original GeoIP that comes with the AMXX 1.9 package - it didn't work.
I tried replacing the GeoIP files from this thread and it didn't work either.
Typing geoip dump <ip>
in a clean 1.9 installation did nothing. Even writing only geoip
doesn't print out any information in the console. It's like the module isn't even installed. The command doesn't exist in 1.8.2 either.
However, downloading GeoIP from the above link and putting it in 1.8.2 adds the command and it works. Doing the same in 1.9 adds the command, but it says Either look up failed or no found results
.
This is not what I'm asking.
I'm asking you to download the latest GeoIP database.
Either: http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz or http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
Use the AMXX 1.9 GeoIP module with the latest GeoIP database.
Yup, downloading the two files fixed both of the problems. I assume they should be included in the AMXX package by default.
You don't need both. The country version is the basic and provided by default. The city is not included by default because much larger as size. But you will need this file if you want to use the city-related natives.
The database should be automatically updated each month (if a build is triggered of course).
The GeoLite2-Country.mmdb
file was updated 4 years ago, if that's what you meant. Anyways, this is a problem for all people who use the latest 1.9, not only for me.
It's because you did not update the database from AMXX 1.9. When a build is triggered, if the current saved database is older than one month, it will download and include the latest version. You can check the date. I'm referring to #524.
That's said, it looks like you need a build from this year. I've no idea why. I hope the issue is not how the buildbot downloads the file and would corrupt it somehow.
The reason geoip is not working is it was packed wrong in 1.9. Download a good copy from https://dev.maxmind.com/geoip/geoip2/geolite2. It was packed as filetype (application/x-tar) and should be Binary (application/octet-stream). Another way is to uncompress the packed version but why when you can get a clean copy?
Makes sense: https://github.com/alliedmodders/amxmodx/pull/524/files#diff-c2a5b25b903e6036e1dc98654263b0cfR77
It's originally a copy-paste from SourceMod, but they're still using the old format which is only .gz
and not tar.gz
. Oopsie.
This is not what I'm asking.
I'm asking you to download the latest GeoIP database.
Either: http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz or http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
Use the AMXX 1.9 GeoIP module with the latest GeoIP database.
Hi, link is dead?
I'm having the same issue as https://github.com/alliedmodders/amxmodx/issues/653#issuecomment-451956607 running on Half-Life 11:26:46 Dec 11 2023 (9909)
with AMXX and GeoIP v1.9.0.5294
. Also, the links @Arkshine provided in https://github.com/alliedmodders/amxmodx/issues/653#issuecomment-451964753 are dead, the URLs require a (free) license key for access.
Detected here - https://forums.alliedmods.net/showthread.php?t=297952&page=10
I used this test plugin:
Results from 1.8.2 and latest 1.9 dev-build using my current IP address (77.29.18.129):
Also notice how
geoip_country
andgeoip_country_ex
give a different value when they can't detect the country. This can be a problem in some cases.In addition, I didn't manage to get the city in neither version, testing with different IP addresses from different countries.