Raised This Month: $ Target: $400
 0% 

Need fix "Teams Limiter"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
okletsgo
Junior Member
Join Date: Aug 2011
Old 12-13-2011 , 09:45   Re: Need fix "Teams Limiter"
Reply With Quote #1

Quote:
Originally Posted by ConnorMcLeod View Post
Try this simple plugin, quickly coded so report bugs if there are some :
PHP Code:
/*    Formatright @ 2011, ConnorMcLeod ....

Something works, but not work all the time , why ?

Can u test it ?
okletsgo is offline
okletsgo
Junior Member
Join Date: Aug 2011
Old 12-20-2011 , 01:06   Re: Need fix "Teams Limiter"
Reply With Quote #2

Quote:
Originally Posted by ConnorMcLeod View Post
Try this simple plugin, quickly coded so report bugs if there are some :
PHP Code:
/*    Formatright @ 2011, ConnorMcLeod

    This plugin is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this plugin; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <fakemeta>
#include <cstrike>

#define VERSION "0.0.1"
#define PLUGIN "Teams Limiter"

const m_iMenu 205
const Menu_Team_Select 1

new g_pCvarMax[CsTeams]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    
g_pCvarMax[CS_TEAM_T] = register_cvar("amx_max_terrorists""3")
    
g_pCvarMax[CS_TEAM_CT] = register_cvar("amx_max_cts""0")
    
g_pCvarMax[CS_TEAM_SPECTATOR] = register_cvar("amx_max_spectators""0")

    
register_clcmd("jointeam""ClCmd_JoinTeam")
    
register_clcmd("menuselect""ClCmd_MenuSelect")
}

public 
ClCmd_JoinTeamid )
{
    new 
szArg[3]
    if( 
read_argv(1szArgcharsmax(szArg)) != )
    {
        return 
PLUGIN_CONTINUE
    
}
    new 
iSlot szArg[0] - '0'
    
if( iSlot == // vip queue // exists with jointeam ????
    
{
        return 
PLUGIN_CONTINUE
    
}
    if( 
iSlot == // auto-assign
    
{
        new 
iCanJoin CanJoinTeam(idiSlot)
        switch( 
iCanJoin )
        {
            case -
1:
            {
                
client_print(idprint_chat"#Cstrike_TitlesTXT_All_Teams_Full")
                return 
PLUGIN_HANDLED
            
}
            case 
5:
            {
                return 
PLUGIN_CONTINUE
            
}
            case 
6:
            {
                
set_pev(idpev_deadflagDEAD_DEAD)
                
engclient_cmd(id"jointeam""6")
                return 
PLUGIN_HANDLED
            
}
            default:
            {
                
szArg[0] = iCanJoin '0'
                
engclient_cmd(id"jointeam"szArg)
                return 
PLUGIN_HANDLED
            
}
        }
    }
    else if( !
CanJoinTeam(idiSlot) )
    {
        switch( 
iSlot )
        {
            case 
1:client_print(idprint_chat"#Cstrike_TitlesTXT_Terrorists_Full")
            case 
2:client_print(idprint_chat"#Cstrike_TitlesTXT_CTs_Full")
            
//case 3:client_print(id, print_chat, "%L", id, "Spectators_Full")
            
case 3:client_print(idprint_chat"The spectator team is full!")
        }
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

public 
ClCmd_MenuSelect(id)
{
    if( 
get_pdata_int(idm_iMenu) == Menu_Team_Select )
    {
        new 
szArg[3]
        if( 
read_argv(1szArgcharsmax(szArg)) != )
        {
            return 
PLUGIN_CONTINUE
        
}
        new 
iSlot szArg[0] - '0'
        
if( iSlot == // vip queue
        
{
            return 
PLUGIN_CONTINUE
        
}
        if( 
iSlot == // auto-assign
        
{
            new 
iCanJoin CanJoinTeam(idiSlot)
            switch( 
iCanJoin )
            {
                case -
1:
                {
                    
client_print(idprint_chat"#Cstrike_TitlesTXT_All_Teams_Full")
                    
client_cmd(id"slot10")
                    return 
PLUGIN_HANDLED
                
}
                case 
5:
                {
                    return 
PLUGIN_CONTINUE
                
}
                case 
6:
                {
                    
set_pev(idpev_deadflagDEAD_DEAD)
                    
engclient_cmd(id"menuselect""6")
                    return 
PLUGIN_HANDLED
                
}
                default:
                {
                    
szArg[0] = iCanJoin '0'
                    
engclient_cmd(id"menuselect"szArg)
                    return 
PLUGIN_HANDLED
                
}
            }
        }
        else if( !
CanJoinTeam(idiSlot) )
        {
            switch( 
iSlot )
            {
                case 
1:client_print(idprint_chat"#Cstrike_TitlesTXT_Terrorists_Full")
                case 
2:client_print(idprint_chat"#Cstrike_TitlesTXT_CTs_Full")
                
//case 3:client_print(id, print_chat, "%L", id, "Spectators_Full")
                
case 3:client_print(idprint_chat"The spectator team is full!")
            }
            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_CONTINUE
}

CanJoinTeam(idiSlot)
{
    new 
CsTeams:iTeam
    
switch( iSlot )
    {
        case 
1,2:
        {
            
iTeam CsTeams:iSlot
        
}
        case 
5:
        {
            
iTeam CS_TEAM_UNASSIGNED
        
}
        case 
6:
        {
            
iTeam CS_TEAM_SPECTATOR
        
}
    }

    new 
iLimit[CsTeams]
    if( 
iTeam )
    {
        if( !( 
iLimit[iTeam] = get_pcvar_numg_pCvarMaxiTeam ] ) ) )
        {
            return 
3
        
}
    }

    for(new 
CsTeams:t=CS_TEAM_Tt<=CS_TEAM_SPECTATORt++)
    {
        if( 
iTeam && t==iTeam )
        {
            continue
        }
        if( !(
iLimit[iTeam] = get_pcvar_numg_pCvarMaxiTeam ] )) )
        {
            
iLimit[iTeam] = 32
        
}
    }
        
    new 
CsTeams:iPlayerTeam cs_get_user_team(id)
    if( 
iTeam == iPlayerTeam )
    {
        return 
3
    
}
    
    new 
iPlayers[32], iNumiTeamCount[CsTeams], iPlayer
    get_players
(iPlayersiNum"h")

    for(--
iNumiNum>=0iNum++)
    {
        
iPlayer iPlayersiNum ]
        if( 
iPlayer == id // either it's auto-assigned, either id is not in the wanted team, don't need to count, musn't count for auto-assigned
        
{
            continue
        }
        
iTeamCountcs_get_user_team(iPlayers[iNum]) ]++
    }

    if( 
iTeam == CS_TEAM_UNASSIGNED // auto assigned
    
{
        new 
iTsSlotsLeft iLimitCS_TEAM_T ] - iTeamCountCS_TEAM_T ]
        new 
iCTsSlotsLeft iLimitCS_TEAM_CT ] - iTeamCountCS_TEAM_CT ]
        if( 
iTsSlotsLeft && iTsSlotsLeft >= iCTsSlotsLeft )
        {
            if( 
iTsSlotsLeft == iCTsSlotsLeft )
            {
                return 
5
            
}
            return 
1
        
}
        else if( 
iCTsSlotsLeft // && ( !iTsSlotsLeft || iTsSlotsLeft < iCTsSlotsLeft )
        
{
            return 
2
        
}
        else if( 
iLimitCS_TEAM_SPECTATOR ] - iTeamCountCS_TEAM_SPECTATOR ] )
        {
            return 
6
        
}
        return -
// wrong settings...
    
}
    return 
iLimitiTeam ] - iTeamCountiTeam ]  > 0

work for you ?
okletsgo is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 12-16-2011 , 11:14   Re: Need fix "Teams Limiter"
Reply With Quote #3

No, you are just impatient.
__________________
joshknifer is offline
Send a message via Skype™ to joshknifer
okletsgo
Junior Member
Join Date: Aug 2011
Old 12-17-2011 , 03:06   Re: Need fix "Teams Limiter"
Reply With Quote #4

No,I'm not , just waiting .
okletsgo is offline
okletsgo
Junior Member
Join Date: Aug 2011
Old 12-19-2011 , 06:36   Re: Need fix "Teams Limiter"
Reply With Quote #5

waiting
okletsgo is offline
okletsgo
Junior Member
Join Date: Aug 2011
Old 12-29-2011 , 04:48   Re: Need fix "Teams Limiter"
Reply With Quote #6

still waiting...........
okletsgo is offline
ANTICHRISTUS
kingdom of weird stuff
Join Date: Jun 2010
Location: My kingdom is not in thi
Old 12-29-2011 , 06:27   Re: Need fix "Teams Limiter"
Reply With Quote #7

https://forums.alliedmods.net/showthread.php?t=165181
__________________
ANTICHRISTUS 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 20:51.


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