The feature of CountryFilter is as follows.
ex.1) C:/Program Files/Steam/SteamApps/myemail@foo.com/source dedicated server/cstrike/addons ex.2) C:/HLServer/source/cstrike/addons
cstrike/addons/CountryFilter.vdf cstrike/addons/CountryFilter.dll cstrike/addons/CountryFilter_i486.so cstrike/addons/GeoIP.dat
"Plugin"
{
"file" "../hl2mp/addons/CountryFilter"
}
] plugin_print Loaded plugins: --------------------- 0: "CountryFilter-1.0.3 by Guwashi, http://d3.jpn.org/" ---------------------Also type "cf_version" on server console to verify CountryFilter's version.
] cf_version "cf_version" = "1.0.3" - CountryFilter Version
Edit server.cfg if you want to customize default settings.
ex.1) // Country code by two characters. ex.) JP cf_country_print_mode "code" ex.2) // Country code by three characters. ex.) JPN cf_country_print_mode "code3" ex.3) // Long country name. ex.) Japan cf_country_print_mode "name"
ex.) // Message format when player was allowed to connect. // First %s is player name. Second %s is country name. // The message will not displayed when setting as cf_allow_message "". cf_allow_message "%s (Country: %s) was allowed to connect." // Message format when player was denied to connect. // First %s is player name. Second %s is country name. // The message will not displayed when setting as cf_deny_message "". cf_deny_message "%s (Country: %s) was rejected by CountryFilter." // Specify the country(s) which is excluded from printing messages. // Available value is same as cf_allow_from and cf_deny_from. cf_message_exclude_from ""
You can limit the connection by using cf_allow_from, cf_deny_from, and cf_order. Please specify this by the country code of two characters. Basically, it is the same as the mod_access module of Apache. See this URL.
http://httpd.apache.org/docs/mod/mod_access.html
cf_allow_from specify the country(s) which is allowed to connect. Available value of cf_allow_from is "all", "", "--" and country code by 2 characters. If you want to specify multiple value, use space as delimiter. Set "all", if you want to allow all countries. When "" (null string) is specified, nothing is done. "--" is unknown country. Note: when you connect to server from LAN, its IP-address is 192.168.xxx.xxx, so this plugin cannot find valid country name. Therefore if you want to allow to connect from LAN, you must specify "--".
ex.1) // Allowing all countries. cf_allow_from "all" ex.2) // Allowing only JP, US and LAN. cf_allow_from "JP US --" ex.3) // Doing nothing. cf_allow_from ""
cf_deny_from specify the country(s) which is deny to connect. Available value of cf_deny_from is quite the same as cf_allow_from.
cf_order controls the default access state and the order in which cf_allow_from and cf_deny_from are evaluated. The value of cf_order must be "deny,allow" or "allow,deny". The default value is "deny,allow".
ex.1) // It is evaluated in order of deny and allow. // Access is allowed by default. cf_order "deny,allow" ex.2) // It is evaluated in order of allow and deny. // Access is denied by default. cf_order "allow,deny"
Some typical usages are shown as follows.
ex.1) // Allowing all countries. (default) cf_order "deny,allow" cf_deny_from "" cf_allow_from "all" ex.2) // Allowing only JP, US and LAN. Others are denied. cf_order "deny,allow" cf_deny_from "all" cf_allow_from "JP US --" ex.3) // Denying only JP. Others are allowed. cf_order "allow,deny" cf_allow_from "all" cf_deny_from "JP"
If you want to find country code, refer this page.
http://www.maxmind.com/app/iso3166
ex.) // Sets alias of cf_status command. cf_status_command_alias "listplayers"
Note: This feature is EXPERIMENTAL. It may delete in the future.
Note: This feature rewrites player's configuration file (config.cfg).
ex.) // Adding the country tag to player name. // 0: off (default), 1: on cf_force_change_name "1"
You can customize the country tag format by using "cf_country_tag".
ex.1) // Country tag format. ex.) JP|Guwashi cf_country_tag "%s|" ex.2) // Country tag format. ex.) [JP]Guwashi cf_country_tag "[%s]"
You can use the following client commands.
ex.)
] cf_status
# userid name uniqueid country
# 1 "foo" STEAM_0:0:xxxxxxx "Japan"
# 2 "bar" STEAM_0:0:xxxxxxx "Canada"
# 3 "baz" STEAM_0:0:xxxxxxx "Thailand"
:
You can specify the alias of cf_status command by using cf_status_command_alias (CVAR).
You must update to latest GeoIP.dat to keep the accuracy of conversion high. Download latest GeoIP.dat from this URL.
Download and extract GeoIP.dat.gz from this URL, and copy it onto addons/GeoIP.dat.
Please tell me your comment, request, idea, and bug report, etc. in the following forums.
The source code is in the "src" folder in the archive. Doxygen'd code can be referred to here.
Guwashi