You are an unregistered user, you can register here
Navigation

Information

Site

Donations
If you wish to make a donation you can by clicking the image below.


BeyondUnreal News

 
Go Back   The Unreal Admins Page > Forums > Front Page > Downloads > Unreal Tournament > Addons & Mutators

Closed Thread
Thread Tools Display Modes
  #1  
Unread 30th December, 2005, 11:11 PM
Rush's Avatar
Rush Rush is offline
Holy Shit!!
 
Join Date: Apr 2003
Location: Poland
Posts: 1,156
Lightbulb IpToCountry (old)

Note: This thread continues over there.


IpToCountry 1.2 for Unreal Tournament '99
Made by [es]Rush
Release Date: 24.07.2006
Distributed under the terms of OpenUnrealMod license - see LICENSE.txt for details

Thanks for opening this readme! Please read its contents before asking any questions.
You can learn:
-General information about IpToCountry and how does it work
-How to install and set it on the server
-How to make use of IpToCountry in your own mod

CHANGELOG
-------
1.2-v2/v3:
-Fix for the Daylight Saving Time and AOL, let's wait to check whether it works. NOTE: The fix is in the Master Server!!
-It should now properly save the data.
-Included the non-database Master Server version by Anthrax.

1.2:
-Added a small clientside package to identify AOL's country. Will work for USA/GB/DE players.
-Added ErrorLimit variable.
-Removed dependency on the DNS resolving system in UnrealEngine which seemed to be crashing the servers.
Now all host based query servers have to specify an IP.

1.1:
-Fixed the texture package, now it is CountryFlags2, this one should be perfect.
-Fixed accessed nones in the Addon part while playing on the server with bots.
-Removed QueryServer instructions cause they were buggy, will fix it later, if you want to run your own
query server now, plase contact me and I'll try to explain everything.

1.0:
-First version

HOW DOES IT WORK?
-------
To your knowledge, resolving a country from an ip requires quite a big database and implementing
it in unrealscript would be very hard, thus IpToCountry connects to a php script which is located
on a http server, this php script uses a mysql database generated from ip-to-country.csv file
kindly distributed by http://ip-to-country.webhosting.info. If you wanna know how the querying
stuff exactly works just "Use the source Luke!".

AOL module is another story. AOL is such a bitch(sorry for the language) that has all its ip ranges registered in
USA and thus it doesn't allow to identify it that easily. Fortunately I found a way to go around the problem.
Three major countries where AOL is very popular are: USA, Great Britain and Germany. All those three have
different timezones, so I just had to get a player's time and compare it to GMT. The idea maybe was mine
but Cratos was the first to implement it in LeagueAS, now I got some code from him so big thx mate.

WHO USES IT?
-------
At the time of writing this readme the following mods/mutators make use of IpToCountry:
-SuperWebAdmin 0.97
-LeagueAS140
-SmartCTF_4D
-BTPlusPlusv097
-Hostname Ban

MANIFEST:
-------
README.txt - this file :P
LICENSE.txt - OpenUnrealMod License
IpToCountry.u - The most important file, has to be in ServerActors - see INSTALLATION
IpToCountry_AOL.u - it has to be added to ServerPackages in order to activate AOL's country detection
CountryFlags2.utx - Country flags miniatures, has to be in ServerPackages if any mod needs it
Source/ - using this source you can modify and adapt IpToCountry to your needs!
QueryServer/ - anything related to hosting your own query server

INSTALLATION
-------
Add the following line to the [Engine.GameEngine] section of UnrealTournament.ini:
ServerActors=IpToCountry.LinkActor
Also if you want AOL players to be detected properly you also need to add this line:
ServerPackages=IpToCountry_AOL

CONFIG
-------
After first run, IpToCountry.ini should be created, edit it, there are 3 variables you can change:
bAddon=True - whether to use the Addon - should be always enabled unless you want to use IpToCountry
in some special way - also read 'NOTE FOR ADMINS'
ConfQueryServer[0] - leave these two unless you know what you're doing
ConfQueryServer[1]
ErrorLimit - IpToCountry will disable itself if the number of errors reaches ErrorLimit

NOTE FOR ADMINS
-------
Even if you have no mod using IpToCountry yet, you can still make use of it because of the Addon.
Mutate commands and example results:
> mutate iptocountry
[es]Rush, Country: POLAND
LanPlayer, Country: Unknown
OtherPlayer, Country: GERMANY
And this one works only for an admin:
> mutate iptohost
[es]Rush, Host: xxx.xxx.xxx.pl
LanPlayer, Host: 192.168.0.3
OtherPlayer, Host: xxx.xxx.de

The Addon also automatically resolves new IPs from joining players.

INSTRUCTION FOR DEVELOPERS
-------
If you want to use IpToCountry in your mod just learn it from my example class, it is pretty simple
and doesn't require compiling with the dependency and linking or how do you call it. :P

Code:
class IpDetails extends Actor;

var Actor IpToCountry;

function PostBeginPlay()
{
	BindIpToCountry();
}

function bool BindIpToCountry()
{
	local Actor A;
	foreach AllActors(class'Actor', A, 'IpToCountry')
		IpToCountry=A;
}

function string GetIpInfo(string IP)
{
	if(IpToCountry != None)
		return IpToCountry.GetItemName(IP);
}
Now calling on function GetIpInfo() with a string parameter should return either the data or the status
of resolving this data, let me show you, the function returns under a high stress(lots of calls) may
return these values, one after another:
1) "!Added to queue"
2) "!Waiting in queue"
3) "!Resolving now"
4) "!AOL - Trying to clarify"
The 1) is always returned if IP wasn't in the database, 2) is very rarely returned, 3) is returned if
querying takes some time, 4) is returned if the AOL module is currently working
Now when the state 3/4 is done it should report the actual data which is returned in the following form:
<IP>:<HOST>:<COUNTRY>:<PREFIX3>:<PREFIX2>
for example "153.19.48.14:lux.eti.pg.gda.pl:POLAND:POL:pl"
Useful data, isn't it ?
The function can also report an error:
1) "!Bad Input"
2) "!Queue full"
3) "!Disabled"
When 3) is returned don't bother to ask IpToCountry again, it means that IpToCountry is unable to contact
any of the query servers.

When you got the right data you have to do some string parsing in order to get anything in a useful form,
you can use for example my SelElem function which is in the LinkActor.uc file in the source.

Now the fun part, when you got last part of the return string, the 2 char long prefix, for example "pl",
you can for example display a country flag on a player's hud/scoreboard.
Use the CountryFlags2.utx file and just do DynamicLoadObject on CountryFlags2.<prefix> for example,
CountryFlags2.pl is a small flag of Poland. The textures are of size 16x16, but the bottom 6 pixels
are masked and shouldn't matter, so the visible size of the textures is 16x10. Remember that CountryFlags2
will have to be added to the ServerPackages, so notify users about it in your instructions.
*You can look at SmartCTF's 4D country flags code if you don't have a clue how to make it.

THANKS TO
-------
AnthraX - for overall help, consultations and helping UT'99 community so much, thx m8!
teleport*bR - thx for the great help in putting the texture package to one, thx also for testing.
Cratos - for supporting IpToCountry in LeagueAS and giving me some code to identify AOL's timezone.
Matthew - for his work for the community.
Unrealadmin - for keeping UT alive.
Attached Files
File Type: zip IpToCountry-1.0.zip (696.6 KB, 466 views)
File Type: zip IpToCountry-1.1.zip (92.2 KB, 483 views)
File Type: zip IpToCountry-1.2.zip (103.5 KB, 535 views)
File Type: zip IpToCountry-1.2-v2.zip (749.3 KB, 293 views)
File Type: zip IpToCountry-1.2-v3.zip (716.6 KB, 1241 views)

Last edited by Wormbo : 19th May, 2010 at 08:50 PM. Reason: New release
  #2  
Unread 30th December, 2005, 11:44 PM
Matthew Matthew is offline
Holy Shit!!
 
Join Date: Dec 2004
Posts: 2,382
Default

Very neat mod. Hopefully some of the scoreboard makers (SmartCTF?) will make use of it.
  #3  
Unread 31st December, 2005, 12:41 AM
Baiter's Avatar
Baiter Baiter is offline
Holy Shit!!
 
Join Date: Apr 2004
Location: Houston, TX
Posts: 1,566
Default

I would like a program or a mod that does this for a list of IPs.

Any takers?
  #4  
Unread 31st December, 2005, 12:49 AM
Rush's Avatar
Rush Rush is offline
Holy Shit!!
 
Join Date: Apr 2003
Location: Poland
Posts: 1,156
Default

Quote:
Originally Posted by Baiter
I would like a program or a mod that does this for a list of IPs.

Any takers?
Just modify my iptocountry-ut.php script a little to return only the country name, now it looks like: http://lux.one.pl/iptocountry-ut.php...14,80.50.43.20
__________________
[email address]

Last edited by Rush : 31st December, 2005 at 02:54 AM.
  #5  
Unread 30th December, 2005, 07:49 PM
Baiter's Avatar
Baiter Baiter is offline
Holy Shit!!
 
Join Date: Mar 2004
Location: Houston, TX
Posts: 1,566
Default

I R teh n00b
  #6  
Unread 1st January, 2006, 06:09 PM
Rush's Avatar
Rush Rush is offline
Holy Shit!!
 
Join Date: Apr 2003
Location: Poland
Posts: 1,156
Default

I decided to modify SmartCTF myself and I'm thinking which would be the best location for a flag, here is my proposition(made in gimp):

Keep in mind that with this position, flags would be drawn only in 800x600 and higher resolutions.

btw. Problems with IpToCountry so far:
-Some accessed nones in IpToCountry.Addon
-Some flags in CountryFlags texture package have to be fixed
-Brightness for CountryFlags texture package has to be increased
__________________
[email address]
  #7  
Unread 1st January, 2006, 06:36 PM
|KOA|The_Dave's Avatar
|KOA|The_Dave |KOA|The_Dave is offline
Godlike
 
Join Date: Jul 2005
Posts: 345
Default

That's cool, Rush :-)
  #8  
Unread 8th January, 2006, 12:12 AM
Matthew Matthew is offline
Holy Shit!!
 
Join Date: Dec 2004
Posts: 2,382
Default

Code:
IpToCountry: utgl.unrealadmin.org/iptocountry-ut.php timed out after 10 seconds!
IpToCountry: utgl.unrealadmin.org/iptocountry-ut.php failed! Trying the alternate.
LinkActor CTF-(SLv)WildRun.LinkActor0 (Function UBrowser.UBrowserHTTPClient.DoBind:000A) BindPort: already bound
UBrowserHTTPLink: Error binding local port.
IpToCountry: Error at resolving the host 153.19.48.14/iptocountry-ut.php!
IpToCountry: 153.19.48.14/iptocountry-ut.php failed! Trying the alternate.
Resolving utgl.unrealadmin.org...
Resolved utgl.unrealadmin.org (85.236.100.16)
LinkActor CTF-(SLv)WildRun.LinkActor0 (Function UBrowser.UBrowserHTTPClient.DoBind:000A) BindPort: already bound
UBrowserHTTPLink: Error binding local port.
IpToCountry: Error at resolving the host utgl.unrealadmin.org/iptocountry-ut.php!
IpToCountry: utgl.unrealadmin.org/iptocountry-ut.php failed! Trying the alternate.
LinkActor CTF-(SLv)WildRun.LinkActor0 (Function UBrowser.UBrowserHTTPClient.DoBind:000A) BindPort: already bound
UBrowserHTTPLink: Error binding local port.
IpToCountry: Error at resolving the host 153.19.48.14/iptocountry-ut.php!
IpToCountry: 153.19.48.14/iptocountry-ut.php failed! Trying the alternate.
Resolving utgl.unrealadmin.org...
Signal: SIGSEGV [segmentation fault]
Aborting.
Exiting.
  #9  
Unread 8th January, 2006, 03:26 AM
Rush's Avatar
Rush Rush is offline
Holy Shit!!
 
Join Date: Apr 2003
Location: Poland
Posts: 1,156
Default

Quote:
Originally Posted by Matthew
Code:
IpToCountry: utgl.unrealadmin.org/iptocountry-ut.php timed out after 10 seconds!
IpToCountry: utgl.unrealadmin.org/iptocountry-ut.php failed! Trying the alternate.
LinkActor CTF-(SLv)WildRun.LinkActor0 (Function UBrowser.UBrowserHTTPClient.DoBind:000A) BindPort: already bound
UBrowserHTTPLink: Error binding local port.
IpToCountry: Error at resolving the host 153.19.48.14/iptocountry-ut.php!
IpToCountry: 153.19.48.14/iptocountry-ut.php failed! Trying the alternate.
Resolving utgl.unrealadmin.org...
Resolved utgl.unrealadmin.org (85.236.100.16)
LinkActor CTF-(SLv)WildRun.LinkActor0 (Function UBrowser.UBrowserHTTPClient.DoBind:000A) BindPort: already bound
UBrowserHTTPLink: Error binding local port.
IpToCountry: Error at resolving the host utgl.unrealadmin.org/iptocountry-ut.php!
IpToCountry: utgl.unrealadmin.org/iptocountry-ut.php failed! Trying the alternate.
LinkActor CTF-(SLv)WildRun.LinkActor0 (Function UBrowser.UBrowserHTTPClient.DoBind:000A) BindPort: already bound
UBrowserHTTPLink: Error binding local port.
IpToCountry: Error at resolving the host 153.19.48.14/iptocountry-ut.php!
IpToCountry: 153.19.48.14/iptocountry-ut.php failed! Trying the alternate.
Resolving utgl.unrealadmin.org...
Signal: SIGSEGV [segmentation fault]
Aborting.
Exiting.
That isn't good, is it ? Did it happen only once ?
__________________
[email address]
  #10  
Unread 8th January, 2006, 01:16 PM
Matthew Matthew is offline
Holy Shit!!
 
Join Date: Dec 2004
Posts: 2,382
Default

I have no idea. My UT browser had the server as down - so I figured it was a map change. I checked again later and so then I got concerned, jumped on FTP. There I found the log, which was 3.3 MBs - and showed no sign of a restarted server (the daemon didn't reboot it). For some reason I had to manually stop the server from the control panel and then restart it - which I've never had to do before.

I'll certainly keep an eye out though.
  #11  
Unread 8th January, 2006, 01:41 PM
Rush's Avatar
Rush Rush is offline
Holy Shit!!
 
Join Date: Apr 2003
Location: Poland
Posts: 1,156
Default

One minor bug found, I accidentally switched 2 error messages "Error at binding the port" and "Error at resolving the host".... but still no idea why your server crashed.
__________________
[email address]
  #12  
Unread 8th January, 2006, 09:46 PM
Matthew Matthew is offline
Holy Shit!!
 
Join Date: Dec 2004
Posts: 2,382
Default

It seems that sometime today it happened again - one of our players reported it down and not restarting again. |KOA|The_Dave restarted it but didn't pull the log, so I can't be sure, but the description sounds the same. Next time we find it hopefully we'll grab the logfile - and if we are lucky figure it out. I know that seg faults are horribly hard to pinpoint - but I have hope...
  #13  
Unread 8th January, 2006, 10:12 PM
|KOA|The_Dave's Avatar
|KOA|The_Dave |KOA|The_Dave is offline
Godlike
 
Join Date: Jul 2005
Posts: 345
Default

My bad on not getting the log ... was watching a movie, people bugged me on instant messenger, I took the quick route and just rebooted it. ^_^;
  #14  
Unread 8th January, 2006, 10:14 PM
Matthew Matthew is offline
Holy Shit!!
 
Join Date: Dec 2004
Posts: 2,382
Default

Dave you are worthless!!!

j/k
  #15  
Unread 9th January, 2006, 01:58 AM
PizzaMan's Avatar
PizzaMan PizzaMan is offline
Holy Shit!!
 
Join Date: Jun 2004
Location: Bergen - Norway
Posts: 2,389
Default

You dont have crash logs?
  #16  
Unread 9th January, 2006, 08:02 AM
Rush's Avatar
Rush Rush is offline
Holy Shit!!
 
Join Date: Apr 2003
Location: Poland
Posts: 1,156
Default

I'm running IpToCountry on 3 servers now and no crashes yet, and I hope it will stay this way.
__________________
[email address]
  #17  
Unread 9th January, 2006, 09:10 AM
Matthew Matthew is offline
Holy Shit!!
 
Join Date: Dec 2004
Posts: 2,382
Default

Well it might very well be that the next crash may not have anything to do with IPToCountry - so we'll just have to wait and see.
  #18  
Unread 9th January, 2006, 09:16 AM
Matthew Matthew is offline
Holy Shit!!
 
Join Date: Dec 2004
Posts: 2,382
Default

Now that's funny... I just went to try connect to webadmin, but it didn't respond.

Code:
IpToCountry: utgl.unrealadmin.org/iptocountry-ut.php timed out after 10 seconds!
IpToCountry: utgl.unrealadmin.org/iptocountry-ut.php failed! Trying the alternate.
LinkActor CTF-2ChickenBlenders.LinkActor0 (Function UBrowser.UBrowserHTTPClient.DoBind:000A) BindPort: already bound
UBrowserHTTPLink: Error binding local port.
IpToCountry: Error at resolving the host 153.19.48.14/iptocountry-ut.php!
IpToCountry: 153.19.48.14/iptocountry-ut.php failed! Trying the alternate.
Resolving utgl.unrealadmin.org...
Resolved utgl.unrealadmin.org (85.236.100.16)
LinkActor CTF-2ChickenBlenders.LinkActor0 (Function UBrowser.UBrowserHTTPClient.DoBind:000A) BindPort: already bound
UBrowserHTTPLink: Error binding local port.
IpToCountry: Error at resolving the host utgl.unrealadmin.org/iptocountry-ut.php!
IpToCountry: utgl.unrealadmin.org/iptocountry-ut.php failed! Trying the alternate.
LinkActor CTF-2ChickenBlenders.LinkActor0 (Function UBrowser.UBrowserHTTPClient.DoBind:000A) BindPort: already bound
UBrowserHTTPLink: Error binding local port.
IpToCountry: Error at resolving the host 153.19.48.14/iptocountry-ut.php!
IpToCountry: 153.19.48.14/iptocountry-ut.php failed! Trying the alternate.
Resolving utgl.unrealadmin.org...
Signal: SIGSEGV [segmentation fault]
Aborting.

It looks word-for-word the same.
  #19  
Unread 9th January, 2006, 12:44 PM
Rush's Avatar
Rush Rush is offline
Holy Shit!!
 
Join Date: Apr 2003
Location: Poland
Posts: 1,156
Default

Try this one Matthew ...
Attached Files
File Type: zip IpToCountry-test1.zip (7.2 KB, 348 views)
__________________
[email address]
  #20  
Unread 9th January, 2006, 03:57 PM
Matthew Matthew is offline
Holy Shit!!
 
Join Date: Dec 2004
Posts: 2,382
Default

OK loaded - let's hope for the best.
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:46 AM.


 

All pages are copyright The Unreal Admins Page.
You may not copy any pages without our express permission.