Raised This Month: $ Target: $400
 0% 

Bot Kick plugin help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
TWiSTEDSOCiETY
Junior Member
Join Date: Jan 2005
Old 08-09-2009 , 10:29   Bot Kick plugin help
Reply With Quote #1

I am trying to work on a previous plugin that was posted by Vato Loco. The plugin sets a set number of active bots and then reduces the bot_quota when a player joins until the max number of bots reaches zero. However when there are no players in the server the bot quota also is set to zero. How could I change this so when there is also zero players in the server that the bots would not leave! Thanks!!

PHP Code:
/* AMX Mod Plugin

* (c) Copyright 2007, DokTor 
* This file is provided as is (no warranties). 

*/ 

#include <amxmod>

new max_botsbot_quota

public plugin_init() {
    
register_plugin("cz bots","0.1","DokTor")
    
max_bots register_cvar("amx_max_bot","10")
    
bot_quota get_cvar_pointer("bot_quota")
}

public 
plugin_cfg() {
    
set_task(5.0"check_players"7896541__"b")
}

public 
check_players() {
    new 
players[32], inumnum
    get_players
(playersnum"c")
    for(new 
ii<num; ++i)
    {
        new 
team get_user_team(players[i])
        if(
team == || team == 2)
            ++
inum
    
}
    
    new 
max get_pcvar_num(max_bots)
    
    if(
inum <= max)
        
set_pcvar_num(bot_quota,max inum)
        
    else if(
inum max)
    {
        
set_pcvar_num(bot_quota,0)

        new 
joueurs[32], bnum
        get_players
(joueursbnum"d")
        for(new 
ii<bnum; ++i)
        {
            if(
is_user_bot(joueurs[i]))
            {
                new 
userid get_user_userid(joueurs[i])
                
server_cmd("kick #%d"userid)
            }
        }
        return
    }

    
check_balance()
}

check_balance() {
    new 
ct[32], terro[32], ctnumtnum
    get_players
(terrotnum"e""1")
    
get_players(ctctnum"e""2")
    if(
ctnum tnum 1)
    {
        for(new 
ii<ctnum; ++i)
        {
            if(
is_user_bot(ct[i]))
            {
                
server_cmd("kick #%d"get_user_userid(ct[i]))
                break
            }
        }
    }
    else if(
tnum ctnum 1)
    {
        for(new 
ii<tnum; ++i)
        {
            if(
is_user_bot(terro[i]))
            {
                
server_cmd("kick #%d"get_user_userid(terro[i]))
                break
            }
        }
    }

TWiSTEDSOCiETY 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 18:20.


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