View Single Post
Old 31/03/2008, 07:43 AM   #1
Totto8492
Little Clucker
 
Join Date: Jan 2007
Posts: 7
Reputation: 6
Default GeoIP Plugin v0.1.4 (Country detector) - 04/05/2008

This is my first practical plugin.
Ah... I don't know what to say.
If you can't read this post (as English), I'm too foolish.

* Last Edit: 04/05/2008:
GeoIP*.dat were move to scriptfiles directory.
Added MAX_COUNTRY_NAME.
Changes arguments(Pawn function).
Pawn functions will return string or value.
Fixed bug in sample filterscript.
Updated GeoIP*.dat.

Native Functions:
Code:
// Two chars into country[]. JP, US, etc...
native GetCountryCode(const ipaddress[], country[], size = sizeof country);
// Three chars into country[]. JPN, USA, etc...
native GetCountryCode3(const ipaddress[], country[], size = sizeof country);
// Full name into country[]. Japan, United States, etc...
native GetCountryName(const ipaddress[], country[], size = sizeof country);
// etc.
Pawn Functions:
Code:
GetPlayerCountryName(playerid); // return country name.
GetPlayerGMT(playerid); // return GMT hour. maybe inaccurate.
// etc.
Please see GeoIP_Plugin.inc . I cant write well. Sorry.

Example:
Code:
#include <a_samp>
#include GeoIP_Plugin
...
public OnPlayerConnect(playerid)
{
	new name[MAX_PLAYER_NAME], country[MAX_COUNTRY_NAME], gmt;
	new string[256];

	GetPlayerName(playerid, name, sizeof(name));

	country = GetPlayerCountryName(playerid);
	gmt = GetPlayerGMT(playerid);

	format(string, sizeof(string), "[JOIN] %s (%s, GMT %d:00)", name, country, gmt);

	SendClientMessageToAll(0xFFCFCFAA, string);
	return 1;
}
Welcome review and complaints.
Maybe, I can read English. Maybe.

geoip_plugin-0.1.4.zip (Package)
geoip_plugin-src-0.1.4.zip (Source)
GeoIP_country_name_253.txt (Country name list from GeoIP.c)

Last edited by dugi; 04/07/2010 at 01:43 PM.
Totto8492 is offline   Reply With Quote