autospec_and_5v5teamlimit

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
368
Реакции
5
Предупреждения
5
Помог
1 раз(а)
Неверный раздел форума
plase add show game spectators

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

#define VGUI_SELECT_TEAM 2
#define MENU_JOINTEAM 1
#define GAMESTATE_JOINTEAM 4

#define XO_PLAYER 5

#define m_iPlayerTeam 114
#define m_iJoiningState 121
#define m_bHasChangeTeamThisRound 125
#define m_iMenu 205

new g_pcvarTeamLimit;

public plugin_init()
{
register_plugin( "Auto Spec + Team Limiter", "0.0.1", "hornet" );

register_clcmd( "jointeam", "ClientCommand_Team" );
register_clcmd( "chooseteam", "ClientCommand_Team" );
register_clcmd( "menuselect", "ClientCommand_Team" );

register_message( get_user_msgid( "MOTD" ), "Message_MOTD" );
register_message( get_user_msgid( "ShowMenu" ), "Message_ShowMenu" );
register_message( get_user_msgid( "VGUIMenu" ), "Message_VGUIMenu" );

g_pcvarTeamLimit = register_cvar( "pug_team_limit", "5" );
}

public client_disconnected( id )
{
remove_task( id );
}

public ClientCommand_Team( id )
{
if( ( get_pdata_int( id, m_iMenu ) == MENU_JOINTEAM && get_pdata_int( id, m_iJoiningState ) == GAMESTATE_JOINTEAM ) || get_pdata_int( id, m_iPlayerTeam ) == 3 )
{
new Players[ 32 ], iNum[ 3 ];
get_players( Players, iNum[ 2 ], "e", "CT" );
get_players( Players, iNum[ 1 ], "e", "TERRORIST" );

new szArg[ 4 ];
read_argv( 1, szArg, charsmax( szArg ) );

new iTeam = str_to_num( szArg );

if( iNum[ iTeam ] >= get_pcvar_num( g_pcvarTeamLimit ) )
{
client_print( id, print_center, "The team is full!" );
engclient_cmd( id, "jointeam", "3" );

return PLUGIN_HANDLED;
}
}

return PLUGIN_CONTINUE;
}

public Message_MOTD()
{
return PLUGIN_HANDLED;
}

public Message_ShowMenu( iMsg, iDest, id )
{
if( cs_get_user_team( id ) != CS_TEAM_UNASSIGNED )
return PLUGIN_CONTINUE;

static MESSAGE[] = "#Team_Select", szMsg[ charsmax( MESSAGE ) ];
get_msg_arg_string( 4, szMsg, charsmax( szMsg ) );

if( equal( szMsg, MESSAGE ) )
{
static data[ 2 ];
data[ 0 ] = iMsg;
set_task(0.1, "task_JoinTeam", id, data, sizeof( data ) );

return PLUGIN_HANDLED;
}

return PLUGIN_CONTINUE;
}

public Message_VGUIMenu( iMsg, iDest, id )
{
if( get_msg_arg_int( 1 ) != VGUI_SELECT_TEAM || cs_get_user_team( id ) != CS_TEAM_UNASSIGNED )
return PLUGIN_CONTINUE;

static data[ 2 ];
data[ 0 ] = iMsg;
set_task(0.1, "task_JoinTeam", id, data, sizeof( data ) );

return PLUGIN_HANDLED;
}

public task_JoinTeam( data[], id )
{
static block;

block = get_msg_block( data[ 0 ] );
set_msg_block( data[0], BLOCK_SET );
engclient_cmd( id, "jointeam", "6" );
set_msg_block( data[0], block );

set_pdata_int( id, m_bHasChangeTeamThisRound, 0, XO_PLAYER )
}

+ team_limit", "5"
2.jpg


- specators not show game player
1.jpg
 
Последнее редактирование:
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу