AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Bot Kick plugin help (https://forums.alliedmods.net/showthread.php?t=99779)

TWiSTEDSOCiETY 08-09-2009 10:29

Bot Kick plugin help
 
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
            }
        }
    }



vato loco [GE-S] 08-09-2009 14:37

Re: Bot Kick plugin help
 
hmmm

TWiSTEDSOCiETY 08-09-2009 14:44

Re: Bot Kick plugin help
 
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)

vato loco [GE-S] 08-09-2009 14:56

Re: Bot Kick plugin help
 
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 !!!

TWiSTEDSOCiETY 08-09-2009 15:17

Re: Bot Kick plugin help
 
Ok i'll try that also! and post back if it works!

vato loco [GE-S] 08-09-2009 15:24

Re: Bot Kick plugin help
 
ok hehehe :wink::mrgreen:

TWiSTEDSOCiETY 08-09-2009 15:56

Re: Bot Kick plugin help
 
Looks like i still get the same error! :(

TWiSTEDSOCiETY 08-09-2009 15:58

Re: Bot Kick plugin help
 
whoops missed the part to use the old code. One sec

vato loco [GE-S] 08-09-2009 16:02

Re: Bot Kick plugin help
 
i'm sure it will work !!! :wink:

TWiSTEDSOCiETY 08-09-2009 16:12

Re: Bot Kick plugin help
 
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.


All times are GMT -4. The time now is 18:20.

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