View Single Post
TheWhitesmith
Senior Member
Join Date: Oct 2017
Location: Morocco :c
Old 11-21-2017 , 12:23   Re: Divide teams in unbalanced teams.
Reply With Quote #8

I actually made a stock to test such things when I dont have players in my server, here is it:
PHP Code:
stock CreateBot(CsTeams:team, const szBotName[], bool:god) {

        if(
find_player("a"szBotName) > 0) {
            
log_to_file("BotSpawner.log""This bot's name is already taken! (%s)"szBotName)
            return -
1
        
}
        
        if(
team != CS_TEAM_CT && team != CS_TEAM_T) {
            
log_to_file("BotSpawner.log""Could not create bot, unknown team!")
            return -
1
        
}
        
        
            new 
id engfuncEngFunc_CreateFakeClientszBotName );
            if( 
pev_validid ) ) {
                
engfuncEngFunc_FreeEntPrivateDataid );
                
dllfuncMetaFunc_CallGameEntity"player"id );
                
set_user_infoid"rate""3500" );
                
set_user_infoid"cl_updaterate""25" );
                
set_user_infoid"cl_lw""1" );
                
set_user_infoid"cl_lc""1" );
                
set_user_infoid"cl_dlmax""128" );
                
set_user_infoid"cl_righthand""1" );
                
set_user_infoid"_vgui_menus""0" );
                
set_user_infoid"_ah""0" );
                
set_user_infoid"dm""0" );
                
set_user_infoid"tracker""0" );
                
set_user_infoid"friends""0" );
                
set_user_infoid"*bot""1" );
                
set_pevidpev_flagspevidpev_flags ) | FL_FAKECLIENT );
                
set_pevidpev_colormapid );
                
                new 
szMsg128 ];
                
dllfuncDLLFunc_ClientConnectidszBotName"127.0.0.1"szMsg );
                
dllfuncDLLFunc_ClientPutInServerid );
                
                
cs_set_user_teamidteam );
                
ExecuteHamBHam_CS_RoundRespawnid );
                
set_user_godmode(idgod 0)
                
set_pevidpev_effectspevidpev_effects ) | EF_NODRAW );
                
set_pevidpev_solidSOLID_NOT );
                
dllfuncDLLFunc_Thinkid );
                
                return 
id
            
}
            
    return -
1
        

returns id of bot created if success, else returns -1

Last edited by TheWhitesmith; 11-21-2017 at 12:24. Reason: removed something unnecessary in the code
TheWhitesmith is offline