GeoIP Locator (IP-to-Country)

Hello,

I’ve learnt and taken so many things from this community, I couldn’t stand there without contributing.

This is a simple addon I’ve coded for my servers which replaces the default


"Player ... has joined the game"

message to


"Player ... has joined from XXX"

An example:

Although I’ve already included April 2010’s Geo IP database in release, I’d like to inform these:
• Addon needs this file unzipped&renamed as geoip.txt under data folder.
• You should manually update geoip.txt once a month in order to achieve %99.5 ip-to-country accuracy.

Plus, you can use this chat command


**!from <player>**

to learn where that players from.

Download:
http://www.garrysmod.org/img/?t=dll&id=95994
Simply extract the zip into your garrysmod folder to install.

Thank you,

  • Xev

Useful addon.

I like it :slight_smile:

Nice.

I made something like this but I used an online database instead, this method is better but using an online database saves you the trouble. It also sent the IP to the clients so that was kind of a security problem.

Great addon, but please don’t sign your own post since it looks really stupid.

Doesn’t work for me. Just same old message when someone joins.
Running dedicated server, if it’s supposed to send a file to the clients it doesn’t as well.

Hello,

It’s supposed to send lua to client. Are you sure you put everything in right places? Could you give more details?

I’ve seen something like this before, but it was 10 times better and you can block people from certain countries

Hello again,

I’m sorry but this is the best I can do with LUA.
It would be beneficial for people if you could share that ten-times-better code with us or give link to it.

On the other hand, I’ll take that “also you can block ppl from certain countries” as a suggestion and add that feature to this code.

What I did was, put the geoip.txt into my Data folder.
then I put the geolocator folder into my addons folder. I restarted the server and. Nada. Nothing.

Everytime I start the script this comes up:
addons/geolocator/lua/autorun/sh_geolocator.lua:120: ‘)’ expected near ‘function’

Can someone please explain to me how to fix this?

FIX:

English
Go to: lua\autorun
Open: sh_geolocator.lua
Change line 120 to:

hook.Add(“PlayerInitialSpawn”, “FROM.PLinit”, function(pl)

German
Öffnet die sh_geolocator.lua in lua\autorun
Geht in Linie 120 und tauscht das mit der vorhanden aus:

hook.Add(“PlayerInitialSpawn”, “FROM.PLinit”, function(pl)

Nice Play
Fankserver