Raised This Month: $12 Target: $400
 3% 

PodBot Manager


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iclassdon
AlliedModders Donor
Join Date: May 2006
Old 01-21-2020 , 14:45   PodBot Manager
Reply With Quote #1

PHP Code:
#include <amxmodx>

new const Version[] = "0.2";

enum PlayerCount
{
    
HumanCount,
    
BotCount
}

new 
g_PlayerCountsPlayerCount ] , g_RoundEnd;
new 
g_pMaxBots;

new const 
g_BotsNeeded32 ] = 
{
    
0// 0 humans
    
5// 1 humans
    
5// 2 humans
    
5// 3 humans
    
5// 4 humans
    
5// 5 humans
    
5// 6 humans
    
5// 7 humans
    
4// 8 humans
    
4// 9 humans
    
3// 10 humans
    
2// 11 humans
    
1  // 12 humans 
       // 13-32 humans = 0 bots
}


public 
plugin_init() 
{
    
register_plugin"PodBot Manager"Version "bugsy" );
    
    
register_logevent"RoundEnd" "1=Round_End" );
    
    
server_cmd"pb removebots" );
    
    
set_cvar_num"pb_bot_quota_match" );
    
set_cvar_num"pb_minbots" );
    
set_pcvar_num( ( g_pMaxBots get_cvar_pointer"pb_maxbots" ) ) , g_BotsNeeded] );
}

public 
client_authorizedid )
{
    
g_PlayerCountsPlayerCount:is_user_botid ) ]++;
    
    
//Handle bots on map change
    
if ( !g_RoundEnd )
    {
        
set_task5.0 "BalanceBots" );
        
g_RoundEnd get_systime();
    }
}

public 
client_disconnected(idbool:dropMsg[], Len)   
{
    
g_PlayerCountsPlayerCount:is_user_botid ) ]--;
}

public 
RoundEnd()
{
    if ( ( 
get_systime() - g_RoundEnd ) > )
    {
        
BalanceBots();
    }
    
    
g_RoundEnd get_systime();
}

public 
BalanceBots()
{
    new 
iNumBots g_PlayerCountsBotCount ];
    new 
iNumHumans g_PlayerCountsHumanCount ];
    new 
iBotsNeeded g_BotsNeedediNumHumans ];
    new 
szName32 ] , iBots32 ] , iBotCount i;
    
    
set_pcvar_numg_pMaxBots iNumHumans iBotsNeeded );
    
    if ( 
iNumBots iBotsNeeded )
    {
        
get_playersiBots iBotCount "d" );
        
        while ( 
iNumBots-- > iBotsNeeded )
        {
            
get_user_nameiBotsi++ ] , szName charsmaxszName ) );
            
server_cmd"pb remove ^"%s^"" szName );
        }
    }
    else if ( 
iNumBots iBotsNeeded )
    {
        while ( 
iNumBots++ < iBotsNeeded )
        {
            
server_cmd"pb add" );
        }
    }

Could someone please help me edit this to work with CSDM. As it is written bot balancing occurs at round end or after first player join on map change/server start. Deathmatch doesn't have rounds.

Please help and thanks.

Last edited by iclassdon; 01-21-2020 at 14:46.
iclassdon is offline
Send a message via MSN to iclassdon
Old 01-21-2020, 17:16
Napoleon_be
This message has been deleted by Napoleon_be. Reason: nvm i'm stupid, can't be done with set_task().
bad_boy
Member
Join Date: Oct 2018
Old 01-21-2020 , 17:59   Re: PodBot Manager
Reply With Quote #2

Maybe this plugin can help you.
https://forums.alliedmods.net/showthread.php?p=631119
bad_boy is offline
iclassdon
AlliedModders Donor
Join Date: May 2006
Old 01-22-2020 , 10:18   Re: PodBot Manager
Reply With Quote #3

Thanks bad_boy.
iclassdon is offline
Send a message via MSN to iclassdon
sb123
Senior Member
Join Date: Jan 2007
Old 01-22-2020 , 11:21   Re: PodBot Manager
Reply With Quote #4

Robot control
Attached Files
File Type: sma Get Plugin or Get Source (podbot_controler.sma - 169 views - 3.2 KB)
__________________
sb123 is offline
Send a message via ICQ to sb123 Send a message via MSN to sb123 Send a message via Yahoo to sb123
Reply


Thread Tools
Display Modes

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 13:53.


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