yes i know ( ' using a enum with trie like this one ' )
PHP Code:
#include <amxmodx>
#include <geoip>
enum _:Country
{
Country_Sweden,
Country_Estonia,
Country_Germany
};
new const g_country_name[Country][] =
{
"Sweden",
"Estonia",
"Germany"
};
new Trie:g_countries;
public plugin_init()
{
g_countries = TrieCreate();
for(new i = 0; i < Country; i++)
{
TrieSetCell(g_countries, g_country_name[i], i);
}
}
public plugin_end()
{
TrieDestroy(g_countries);
}
check_country(id)
{
new ip[32], country[46];
get_user_ip(id, ip, charsmax(ip), 1);
geoip_country(ip, country, charsmax(country));
new country_id;
if(TrieGetCell(g_countries, country, country_id))
{
// "country" is "Sweden" "Estonia" or "Germany"
switch(country_id)
{
case Country_Sweden:
{
// "country" is "Sweden"
}
case Country_Estonia:
{
// "country" is "Estonia"
}
case Country_Germany:
{
// "country" is "Germany"
}
}
}
else
{
// "country" is any other string
}
}