#include <amxmodx>
#include <sxgeo>
new const g_szCountries[][] = { "ru" /*, "de" */ }
new const g_szKickReason[] = "Players from your country are not allowed here."
new Trie:g_tCountries
public plugin_init()
{
register_plugin("SxGeo: Country Kicker WHITELIST", "1.1b", "OciXCrom|wopox1337")
g_tCountries = TrieCreate()
for(new i; i < sizeof(g_szCountries); i++)
TrieSetCell(g_tCountries, g_szCountries[i], true)
}
public plugin_end()
TrieDestroy(g_tCountries)
public client_connect(id)
{
new szIP[22], szCode[3]
get_user_ip(id, szIP, charsmax(szIP))
sxgeo_code(szIP, szCode)
log_amx("%s connected from %s", szIP, szCode)
if(!TrieKeyExists(g_tCountries, szCode))
server_cmd("kick #%i ^"%s^"", get_user_userid(id), g_szKickReason)
}