Raised This Month: $32 Target: $400
 8% 

[CSGO] [Paid] Can't add bot: Team is full and all players stuck on one team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
aeleos
Member
Join Date: Sep 2014
Old 04-12-2015 , 16:12   [CSGO] [Paid] Can't add bot: Team is full and all players stuck on one team
Reply With Quote #1

I am having a problem in my server where on some maps all players are stuck joining on one side. In addition to this I have a replay bot set up to join bots on the team that has the least players, but I get the error Could not add bot: team is full. One piece of code that I found that helps is
PHP Code:
#include <cstrike> 
#include <sourcemod> 
#include <sdktools> 

public OnPluginStart() 

    
HookEvent("player_connect_full"Event_OnFullConnectEventHookMode_Pre); 
    
HookEvent("cs_match_end_restart"Event_OnMatchRestartEventHookMode_Pre); 
    
HookEvent("player_team"Event_OnPlayerTeamEventHookMode_Pre); 
    
AddCommandListener(Command_Join"jointeam"); 


public 
Action:Event_OnFullConnect(Handle:event, const String:name[], bool:dontBroadcast

    new 
client GetClientOfUserId(GetEventInt(event"userid")); 
    if(!
client || !IsClientInGame(client)) 
        return 
Plugin_Continue

    new 
iRediBlue
    for(new 
1<= MaxClientsi++) 
    { 
        if(!
IsClientInGame(i)) 
            continue; 

        new 
iTeam GetClientTeam(i); 
        if(
iTeam == CS_TEAM_T
            
iRed++; 
        else if(
iTeam == CS_TEAM_CT
            
iBlue++; 
    } 

    if(
iRed iBlue
        
SetEntProp(clientProp_Send"m_iTeamNum"CS_TEAM_T); 
    else 
        
SetEntProp(clientProp_Send"m_iTeamNum"CS_TEAM_CT); 

    
ForcePlayerSuicide(client); 
    
CS_RespawnPlayer(client); 
    return 
Plugin_Continue


public 
Action:Event_OnMatchRestart(Handle:event, const String:name[], bool:dontBroadcast

    new 
iRediBlueiJoin
    for(new 
1<= MaxClientsi++) 
    { 
        if(!
IsClientInGame(i)) 
            continue; 

        switch(
GetClientTeam(i)) 
        { 
            case 
CS_TEAM_T
                
iRed++; 
            case 
CS_TEAM_CT
                
iBlue++; 
        } 
    } 

    for(new 
1<= MaxClientsi++) 
    { 
        if(!
IsClientInGame(i)) 
            continue; 

        if(
iRed iBlue
            
iJoin CS_TEAM_T
        else if(
iBlue iRed
            
iJoin CS_TEAM_CT
        else 
            
iJoin GetRandomInt(CS_TEAM_TCS_TEAM_CT); 

        switch(
iJoin
        { 
            case 
CS_TEAM_T
                
iRed++; 
            case 
CS_TEAM_CT
                
iBlue++; 
        } 

        
ChangeClientTeam(iiJoin); 
    } 


public 
Action:Event_OnPlayerTeam(Handle:event, const String:name[], bool:dontBroadcast

    new 
client GetClientOfUserId(GetEventInt(event"userid")); 
    if(!
client || !IsClientInGame(client)) 
        return 
Plugin_Continue

    if(!
IsPlayerAlive(client)) 
        
CreateTimer(0.1Timer_RespawnGetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE); 
    return 
Plugin_Continue


public 
Action:Timer_Respawn(Handle:timerany:userid

    new 
client GetClientOfUserId(userid); 
    if(!
client
        return 
Plugin_Continue

    new 
iTeam GetClientTeam(client); 
    if(
iTeam <= CS_TEAM_SPECTATOR
        return 
Plugin_Continue

    if(
IsPlayerAlive(client)) 
        return 
Plugin_Continue

    
CS_RespawnPlayer(client); 

    return 
Plugin_Continue


public 
Action:Command_Join(client, const String:command[], argc

    
decl String:sJoining[8]; 
    
GetCmdArg(1sJoiningsizeof(sJoining)); 
    new 
iJoining StringToInt(sJoining); 
    if(
iJoining == CS_TEAM_SPECTATOR
        return 
Plugin_Continue

    new 
iTeam GetClientTeam(client); 
    if(
iJoining == iTeam
        return 
Plugin_Handled
    else 
    { 
        
SetEntProp(clientProp_Send"m_iTeamNum"iJoining); 
        
ForcePlayerSuicide(client); 
        
CS_RespawnPlayer(client); 
    } 

    return 
Plugin_Continue

But this causes frequent crashes. I have tried the CSGO Teamlimits plugin along with spawntools 7 and none of them work. If someone can find a fix for the code posted or a different fix I would be willing to pay you. The link to the thread where that code is posted is https://forums.alliedmods.net/showthread.php?t=223802
aeleos is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 04-12-2015 , 22:58   Re: [CSGO] [Paid] Can't add bot: Team is full and all players stuck on one team
Reply With Quote #2

Looks like your trying to respawn a player who is not fully ingame.
__________________
Neuro Toxin is offline
aeleos
Member
Join Date: Sep 2014
Old 04-12-2015 , 23:01   Re: [CSGO] [Paid] Can't add bot: Team is full and all players stuck on one team
Reply With Quote #3

Quote:
Originally Posted by Neuro Toxin View Post
Looks like your trying to respawn a player who is not fully ingame.
What do you mean by that? Is that the cause of the crashes or the cause of the Team is full error?
aeleos is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 04-12-2015 , 23:23   Re: [CSGO] [Paid] Can't add bot: Team is full and all players stuck on one team
Reply With Quote #4

Wait. My bad. Cant comprehend english in the morning.

That wouldnt be it.

You got any errors in the sourcemod logs?
__________________
Neuro Toxin is offline
aeleos
Member
Join Date: Sep 2014
Old 04-13-2015 , 09:23   Re: [CSGO] [Paid] Can't add bot: Team is full and all players stuck on one team
Reply With Quote #5

Quote:
Originally Posted by Neuro Toxin View Post
Wait. My bad. Cant comprehend english in the morning.

That wouldnt be it.

You got any errors in the sourcemod logs?
No errors, just the generic core dumped crash. The only way I was able to figure out the source of the crashes was systematically removing plugins until this one fixed it.
aeleos is offline
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 09:31.


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