Raised This Month: $ Target: $400
 0% 

Slot reservation


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
reinert
Veteran Member
Join Date: Feb 2007
Old 04-06-2011 , 15:01   Slot reservation
Reply With Quote #1

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
    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_namewhoname 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 
1<= maxplayers; ++i){
        new 
szCountry[3];
        new 
iIp[35];
        
get_user_ip(iiIp341)
        
geoip_code2(iIpszCountry)
        
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

reinert is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode