Hey, I was looking for an IP to Country/Location script recently and I found quite a few.
(ex. [url]http://facepunch.com/showthread.php?t=922630[/url] and [url]http://facepunch.com/showthread.php?t=874331[/url])
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:
[code]
[ERROR] lua/includes/modules/http.lua:34: attempt to call upvalue 'onsuccess' (a
string value)
1. unknown - lua/includes/modules/http.lua:34
[/code]
[QUOTE=Handsome Matt;45353573][URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index80e6.html"]http.Get [/URL]and [URL="http://wiki.garrysmod.com/page/http/Fetch"]http.Fetch[/URL] have different arguments.
( remove the second argument "" and it will work )[/QUOTE]
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:
[code]
[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
[/code]
Line of code:
[code]
tbl["country code"] = xml[3][1]
[/code]
I'm guessing it has something to do with the site being updated or unavailable?
[QUOTE=kpjVideo;45353804]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:
[code]
[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
[/code]
Line of code:
[code]
tbl["country code"] = xml[3][1]
[/code]
I'm guessing it has something to do with the site being updated or unavailable?[/QUOTE]
Probably. I have written something similar in the past and I would recommend using [URL]http://www.iptolatlng.com/[/URL] or something similar since gmod has built in json functions.
[QUOTE=Dinnanid;45353952]Probably. I have written something similar in the past and I would recommend using [URL]http://www.iptolatlng.com/[/URL] or something similar since gmod has built in json functions.[/QUOTE]
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
[url]http://pastebin.com/twzE33XM[/url]
paste this to a file called geoip.lua on lua/autorun
Thanks for all the help <3
Sorry, you need to Log In to post a reply to this thread.