Raised This Month: $ Target: $400
 0% 

Need fix "Teams Limiter"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-11-2011 , 18:10   Re: Need fix "Teams Limiter"
Reply With Quote #1

Quote:
Originally Posted by okletsgo View Post
(Early pm author ,but not reply.)
Don't PM the author. Search the thread then post in the thread if you can't find the solution.
__________________
fysiks is offline
okletsgo
Junior Member
Join Date: Aug 2011
Old 12-12-2011 , 07:24   Re: Need fix "Teams Limiter"
Reply With Quote #2

Quote:
Originally Posted by fysiks View Post
Don't PM the author. Search the thread then post in the thread if you can't find the solution.
This problem is not solved .
okletsgo is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-13-2011 , 02:01   Re: Need fix "Teams Limiter"
Reply With Quote #3

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

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 12-13-2011 at 12:18.
ConnorMcLeod is offline
okletsgo
Junior Member
Join Date: Aug 2011
Old 12-13-2011 , 09:45   Re: Need fix "Teams Limiter"
Reply With Quote #4

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
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-13-2011 , 12:20   Re: Need fix "Teams Limiter"
Reply With Quote #5

I really don't know, and you don't really help saying that it sometimes works and sometimes not.
I'm pretty sure that it doesn't support bots, so don't test with bots.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
okletsgo
Junior Member
Join Date: Aug 2011
Old 12-14-2011 , 04:32   Re: Need fix "Teams Limiter"
Reply With Quote #6

Quote:
Originally Posted by ConnorMcLeod View Post
I really don't know, and you don't really help saying that it sometimes works and sometimes not.
I'm pretty sure that it doesn't support bots, so don't test with bots.


Before works is test by Bot ,But now my friends (Not Bot) test your update code:
"amx_max_terrorists 1 and amx_max_cts 1" not work !
plz fix that .

Last edited by okletsgo; 12-14-2011 at 09:28.
okletsgo is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-17-2011 , 05:48   Re: Need fix "Teams Limiter"
Reply With Quote #7

Quote:
Originally Posted by okletsgo View Post


Before works is test by Bot ,But now my friends (Not Bot) test your update code:
"amx_max_terrorists 1 and amx_max_cts 1" not work !
plz fix that .
You still don't help, describe what he is doing, is he trying to reach CT team from T team or from Unassigned, is he using old menus or VGUI menus, etc...
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
okletsgo
Junior Member
Join Date: Aug 2011
Old 12-15-2011 , 05:32   Re: Need fix "Teams Limiter"
Reply With Quote #8

Quote:
Originally Posted by ConnorMcLeod View Post
I really don't know, and you don't really help saying that it sometimes works and sometimes not.
I'm pretty sure that it doesn't support bots, so don't test with bots.
update?
okletsgo is offline
okletsgo
Junior Member
Join Date: Aug 2011
Old 12-16-2011 , 03:43   Re: Need fix "Teams Limiter"
Reply With Quote #9

Quote:
Originally Posted by ConnorMcLeod View Post
I really don't know, and you don't really help saying that it sometimes works and sometimes not.
I'm pretty sure that it doesn't support bots, so don't test with bots.
ConnorMcLeod has gone ??
okletsgo is offline
okletsgo
Junior Member
Join Date: Aug 2011
Old 12-20-2011 , 01:06   Re: Need fix "Teams Limiter"
Reply With Quote #10

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
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