Forum

> > CS2D > Scripts > Script Rank When you join and country
Forums overviewCS2D overview Scripts overviewLog in to reply

English Script Rank When you join and country

2 replies
To the start Previous 1 Next To the start

old Script Rank When you join and country

Slooper 1
BANNED Off Offline

Quote
Rank when you join and country , its hard codes , i dont now i'm newbie, Please if u want help me
i make exmple : Player join from hongkong rank 2
i hope your help can make effect

old Re: Script Rank When you join and country

VaiN
User Off Offline

Quote
For rank you would need to use an admin system of some sort.

For Country/Region, I don't recommend the locmod because it uses a static csv file and doesn't update.

For servers on Linux you can use the "geoiplookup" command. For Debian-based distros you'll need to install the "geoip-bin" package.

Example usage:
1
2
3
4
5
6
7
8
9
10
11
12
function lookup(ip)
	local handle = io.popen("geoiplookup " .. ip)
	local ret = handle:read("*a")
	handle:close()
	if not ret or ret == "" then return end
	if ret:find("can't resolve") ~= nil then return end
	if ret:find("not found") ~= nil then return end
	-- strip everything but the actual result
	local result = ret:match(":[%s]([%w].+)\n")
	print("Geo-IP Result for IP " .. ip .. " is " .. result)
	return result
end

This way you can always have up-to-date geo-ip data. If you are on Windows, stick with the locmod.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview