Why this doesn't work ? It should kick except for Estonia random player.
Like if admin comes, the Sweden or Russian player will be kicked...
PHP Code:
public client_authorized(id) {
new maxplayers = get_maxplayers()
new players = get_playersnum( 1 )
new limit = maxplayers - 1
new who
if ( players > limit )
{
if ( get_user_flags(id) & ADMIN_RESERVATION )
{
who = kickEmi()
if(who) {
new name[32]
get_user_name( who, name , 31 )
client_cmd(id,"echo ^"* %s was kicked to free this slot^"" ,name )
}
return PLUGIN_CONTINUE
}
if ( is_user_bot(id) )
server_cmd("kick #%d", get_user_userid(id) )
else
client_cmd(id,"echo ^"Server is Full.^";disconnect")
return PLUGIN_HANDLED // block connect in other plugins (especially in consgreet)
}
return PLUGIN_CONTINUE;
}
PHP Code:
kickEmi() {
new who = 0
new maxplayers = get_maxplayers()
for(new i = 1; i <= maxplayers; ++i){
new szCountry[3];
new iIp[35];
get_user_ip(i, iIp, 34, 1)
geoip_code2(iIp, szCountry)
strtolower(szCountry)
if ( !is_user_connected(i) && !is_user_connecting(i) )
continue // not used slot
if (get_user_flags(i)&ADMIN_RESERVATION)
continue // has reservation, skip him
if (equali(szCountry, "ee") || equali(szCountry, "er"))
continue // is from estonia or unknown country (may be estonia aswell)
if(who)
{
who = i
}
}
if(who)
if ( is_user_bot(who) )
server_cmd("kick #%d", get_user_userid(who) )
else
client_cmd(who,"disconnect")
return who
}