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

Limit the maximum number of TR and CT (5X5)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dark22
Junior Member
Join Date: Dec 2008
Old 11-18-2009 , 19:47   Limit the maximum number of TR and CT (5X5)
Reply With Quote #1

I would like if possible to limit the maximum number of teams in 5x5, both CT and TR team, that would be most useful in games MIX. I found the plugin below, works perfectly, but it limits only the TR team. I wish that limited the two. If the author of the plugin or any other user help I would be very grateful.

http://forums.alliedmods.net/showthr...ght=limit+team
Code:

#include <amxmodx>

enum
{
    TEAM_T = 1,
    TEAM_CT,
    TEAM_SPEC
};


new TCount;
new TLimitPcvar;
new bool:TransferredT[33]; // Bypass double call.

public plugin_init()
{
    register_plugin("Terrorists Limiter", "1.0", "Dores");
    
    TLimitPcvar = register_cvar("terror_limit", "2");
    
    register_event("TeamInfo", "TeamInfo_NotTerror_Event", "a", "2!TERRORIST");
    register_event("TeamInfo", "TeamInfo_Terror_Event", "a", "2&TERRORIST");
    
    register_clcmd("jointeam", "Cmd_HookJoinTeam");
}

public Cmd_HookJoinTeam(id)
{
    new arg[1], team;
    
    read_argv(1, arg, 1);
    team = str_to_num(arg);
    
    if(team != TEAM_T)
    {
        return PLUGIN_CONTINUE;
    }
    
    if(TCount == get_pcvar_num(TLimitPcvar))
    {
        client_print(id, print_chat, "Terrorists team has reached it's limit");
        
        if(get_user_team(id) == TEAM_SPEC)
        {
            client_cmd(id, "jointeam %d", TEAM_CT);
        }
        
        return PLUGIN_HANDLED;
    }
    
    return PLUGIN_CONTINUE;
}

public TeamInfo_NotTerror_Event()
{
    new id = read_data(1);
    
    if(TransferredT[id])
    {
        TransferredT[id] = false;
        TCount--;
    }
}

public TeamInfo_Terror_Event()
{
    new id = read_data(1);
    
    if(!TransferredT[id])
    {
        TransferredT[id] = true;
        TCount++;
    }
}

public client_disconnect(id)
{
    TransferredT[id] = false;
}

public server_changelevel(map[])
{
    TCount = 0;
}

public plugin_pause()
{
    TCount = 0;
} 

Last edited by dark22; 11-19-2009 at 07:38.
dark22 is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 11-19-2009 , 04:49   Re: Limit the maximum number of TR and CT (5X5)
Reply With Quote #2

Not tested at all.

Code:
#include < amxmodx > #include < cstrike > new const g_iMaxSlots[ CsTeams ] = {     0, // CS_TEAM_UNASSIGNED     5, // CS_TEAM_T     5, // CS_TEAM_CT     0  // CS_TEAM_SPECTATOR }; new const g_szTeamChars[ CsTeams ] = {     'U', // CS_TEAM_UNASSIGNED     'T', // CS_TEAM_T     'C', // CS_TEAM_CT     'S'  // CS_TEAM_SPECTATOR }; new g_iPlayers[ CsTeams ]; public plugin_init( ) {     register_plugin( "Team Limiter", "0.1.0", "Xellath" );         register_event( "TeamInfo", "eventTeamInfo", "a" ); } public eventTeamInfo( ) {     static iClient, szTeam[ 2 ], CsTeams:iTeam;     iClient = read_data( 1 );     read_data( 2, szTeam, 1 );         iTeam = CharToTeam( szTeam[ 0 ] );         g_iPlayers[ iTeam ]++;         if( g_iPlayers[ iTeam ] == g_iMaxSlots[ iTeam ] )     {         g_iPlayers[ iTeam ]--;                 client_cmd( iClient, "jointeam %d", CS_TEAM_SPECTATOR );     } } CsTeams:CharToTeam( szChar ) {     static CsTeams:iTeam;     for( iTeam = CS_TEAM_UNASSIGNED; iTeam <= CS_TEAM_SPECTATOR; iTeam++ )     {         if( szChar == g_szTeamChars[ iTeam ] )         {             return iTeam;         }     }         return CS_TEAM_UNASSIGNED; // returned if code above fails }
__________________
Achievements API - a simple way for you to create your OWN custom achievements!

Last edited by Xellath; 11-20-2009 at 01:24. Reason: Fixed.
Xellath is offline
dark22
Junior Member
Join Date: Dec 2008
Old 11-19-2009 , 05:50   Re: Limit the maximum number of TR and CT (5X5)
Reply With Quote #3

I tested the plugin posted by you, but it works in something other of the foregoing. The by you allow new players to connect to the server and join a team, to join a team of any player is kicked from the server. What I posted, allows new players to join the team, but if it is full, it is automatically sent to spectador.

I very much appreciate your cooperation and good will. But I would like that if possible the plugin to work in the manner which I posted, again I leave the topic open discursão for others, you or the author of the plugin can help me.

Again, thank you!
dark22 is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 11-19-2009 , 06:10   Re: Limit the maximum number of TR and CT (5X5)
Reply With Quote #4

Try it now.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
dark22
Junior Member
Join Date: Dec 2008
Old 11-19-2009 , 06:49   Re: Limit the maximum number of TR and CT (5X5)
Reply With Quote #5

Does not work, until you reach the quota players enter teams but no score will remain as spectators. Upon reaching the quota error occurs in hlds.
dark22 is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 11-19-2009 , 15:00   Re: Limit the maximum number of TR and CT (5X5)
Reply With Quote #6

Try the code now.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 11-19-2009 , 15:12   Re: Limit the maximum number of TR and CT (5X5)
Reply With Quote #7

Code:
iTeam = CharToTeam( szTeam ); -> iTeam = CharToTeam( szTeam[ 0 ] );
Code:
if( contain( szChar, g_szTeamChars[ iTeam ] ) ) -> if( szChar == g_szTeamChars[ iTeam ] )
__________________
xPaw is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 11-19-2009 , 15:32   Re: Limit the maximum number of TR and CT (5X5)
Reply With Quote #8

Quote:
Originally Posted by xPaw View Post
Code:
if( szChar == g_szTeamChars[ iTeam ] )
Noes.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-19-2009 , 15:48   Re: Limit the maximum number of TR and CT (5X5)
Reply With Quote #9

Code:
new const g_szTeamChars[ CsTeams ] =
Code:
    iTeam = CharToTeam( szTeam[ 0 ] );
Code:
CsTeams:CharToTeam( szChar )
Code:
        if( szChar == g_szTeamChars[ iTeam ] )
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 11-20-2009 , 01:25   Re: Limit the maximum number of TR and CT (5X5)
Reply With Quote #10

Fine then.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath 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 15:48.


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