GeoIP IP to Location Script?

Hey, I was looking for an IP to Country/Location script recently and I found quite a few.
(ex. http://forum.facepunch.com/showthread.php?t=922630 and http://forum.facepunch.com/showthread.php?t=874331)
but most of the ones I have tried so far have given no result at all, and after scanning quickly through the code I can’t figure out how to get a system like this to actually work.
Basically it converts the user(s) IP address into location to say when they join the/a server(s). (ex: Player1 has joined the server from ____)

If anyone knows where I could find a working one or a fix for one of the following, that would be much appreciated.

Thanks

ps: After attempting to use the second example, I got an error message around http.Get which I tried replacing with http.Fetch but still no avail, and returned this instead, and no message in the chat:



[ERROR] lua/includes/modules/http.lua:34: attempt to call upvalue 'onsuccess' (a
 string value)
  1. unknown - lua/includes/modules/http.lua:34


http.Getand http.Fetch have different arguments.

( remove the second argument “” and it will work )

Ahh, why thank you.
Seemed to clear up that error, but I’ve stumbled upon yet another problem. (This will probably be a bit more complicated.)
Error:



[ERROR] addons/geolocator/lua/autorun/iptocountry.lua:262: attempt to index a ni
l value
  1. ParseContent - addons/geolocator/lua/autorun/iptocountry.lua:262
   2. onsuccess - addons/geolocator/lua/autorun/iptocountry.lua:249
    3. unknown - lua/includes/modules/http.lua:34


Line of code:



tbl["country code"] = xml[3][1]


I’m guessing it has something to do with the site being updated or unavailable?

Probably. I have written something similar in the past and I would recommend using http://www.iptolatlng.com/ or something similar since gmod has built in json functions.

Oh, I’ll have to check it out, thanks for the recommendation. Not too fond of json and similar functions, so I’ll probably end up having someone do it as a paid job.

I can do it for free…

[editline]11th July 2014[/editline]

Just add me on steam

http://pastebin.com/twzE33XM

paste this to a file called geoip.lua on lua/autorun

Thanks for all the help <3