AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   TeamInfo Message (https://forums.alliedmods.net/showthread.php?t=185387)

OvidiuS 05-16-2012 15:05

TeamInfo Message
 
When is it called? When player change team, or when player join team, on spawn, etc..
Code:

        register_message(get_user_msgid("TeamInfo"), "msgTeamInfo")
Can i do something like this to block join ct team if more than 3 player in ct team?
Code:

#include < amxmodx >
#include < cstrike >

public plugin_init( )
{
        register_message(get_user_msgid("TeamInfo"), "msgTeamInfo")
}

public msgTeamInfo(msg_id, msg_dest)
{
        if (msg_dest != MSG_ALL && msg_dest != MSG_BROADCAST)
                return;
       
        static iTeam[2];
        get_msg_arg_string(2, iTeam, charsmax(iTeam))
       
        switch (iTeam[0])
        {
                case 'C':
                {
                        new iCT = GetPlayerCount( CS_TEAM_CT );
                        if( iCT > 3 ) set_msg_arg_string( 2, "TERRORIST" );
                }
        }
}

GetPlayerCount( CsTeams:iTeam )
{
        new iPlayers[ 32 ] , iPlayerCount;
        new iTeamPlayers[ CsTeams ];
       
        get_players( iPlayers , iPlayerCount );
       
        for ( new i = 0 ; i < iPlayerCount ; i++ )
                iTeamPlayers[ cs_get_user_team( iPlayers[ i ] ) ]++;
 
        return iTeamPlayers[ iTeam ];
}


<VeCo> 05-16-2012 15:36

Re: TeamInfo Message
 
TeamInfo is called very often for various things.
Try to hook chooseteam and jointeam commands.

OvidiuS 05-16-2012 16:56

Re: TeamInfo Message
 
Quote:

Originally Posted by <VeCo> (Post 1710165)
TeamInfo is called very often for various things.
Try to hook chooseteam and jointeam commands.

Thank's for helping, but it would be nice if you write that "various things".


All times are GMT -4. The time now is 00:30.

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