Raised This Month: $ Target: $400
 0% 

Bot Kick plugin help


Post New Thread Reply   
 
Thread Tools Display Modes
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
Old 08-09-2009, 14:28
vato loco [GE-S]
This message has been deleted by vato loco [GE-S]. Reason: ...
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 08-09-2009 , 14:37   Re: Bot Kick plugin help
Reply With Quote #2

hmmm
__________________

Last edited by vato loco [GE-S]; 08-09-2009 at 14:56.
vato loco [GE-S] is offline
TWiSTEDSOCiETY
Junior Member
Join Date: Jan 2005
Old 08-09-2009 , 14:44   Re: Bot Kick plugin help
Reply With Quote #3

Thanks VERY much for helping!! I've tested it and run it in debug mode. Here is the output of the error.

Invalid CVAR pointer
L 08/09/2009 - 18:42:16: [AMXX] Displaying debug trace (plugin "czbot.amxx")
L 08/09/2009 - 18:42:16: [AMXX] Run time error 10: native error (native "set_pcvar_num")
L 08/09/2009 - 18:42:16: [AMXX] [0] textYXChSX.sma::check_players (line 34)
L 08/09/2009 - 18:42:20: Invalid CVAR pointer
L 08/09/2009 - 18:42:20: [AMXX] Displaying debug trace (plugin "czbot.amxx")
L 08/09/2009 - 18:42:20: [AMXX] Run time error 10: native error (native "set_pcvar_num")
L 08/09/2009 - 18:42:20: [AMXX] [0] textYXChSX.sma::check_players (line 34)
TWiSTEDSOCiETY is offline
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 08-09-2009 , 14:56   Re: Bot Kick plugin help
Reply With Quote #4

ok i will try to fix this...
but you can try to do this set in your amxx.cfg
bot_join_after_player 0
and use your code that you have post and test it
i think that should work too !!!
__________________
vato loco [GE-S] is offline
TWiSTEDSOCiETY
Junior Member
Join Date: Jan 2005
Old 08-09-2009 , 15:17   Re: Bot Kick plugin help
Reply With Quote #5

Ok i'll try that also! and post back if it works!
TWiSTEDSOCiETY is offline
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 08-09-2009 , 15:24   Re: Bot Kick plugin help
Reply With Quote #6

ok hehehe
__________________
vato loco [GE-S] is offline
TWiSTEDSOCiETY
Junior Member
Join Date: Jan 2005
Old 08-09-2009 , 15:56   Re: Bot Kick plugin help
Reply With Quote #7

Looks like i still get the same error!
TWiSTEDSOCiETY is offline
TWiSTEDSOCiETY
Junior Member
Join Date: Jan 2005
Old 08-09-2009 , 15:58   Re: Bot Kick plugin help
Reply With Quote #8

whoops missed the part to use the old code. One sec
TWiSTEDSOCiETY is offline
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 08-09-2009 , 16:02   Re: Bot Kick plugin help
Reply With Quote #9

i'm sure it will work !!!
__________________
vato loco [GE-S] is offline
TWiSTEDSOCiETY
Junior Member
Join Date: Jan 2005
Old 08-09-2009 , 16:12   Re: Bot Kick plugin help
Reply With Quote #10

Ok tried it, but now the plugin loads with no errors, but no bots join when your out of the server or in the server.
TWiSTEDSOCiETY is offline
Reply



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:21.


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