technical Pause

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
368
Реакции
5
Предупреждения
5
Помог
1 раз(а)
#include <amxmodx>

const MIN_PLAYERS = 3;
const PAUSE_DURATION = 60;
const TASK_FINISHVOTE = 1337;

new const g_szTeamNames[][] = {"UNASSIGNED","TERRORIST","CT","SPECTATOR"};
new g_iVotes, g_iMenu, g_iNeeded, g_iSaveValue, bool:g_bDotechnicalPause, g_itechnicalPause[2];

public plugin_init( )
{
register_plugin( "technical Pause", "1.0", "Manu" );

register_clcmd( "say /pause", "CommandPause" );
register_logevent( "ev_RoundStart", 2, "1=Round_Start" );
}

public ev_RoundStart( )
{
g_bDotechnicalPause = false;
set_cvar_num( "mp_freezetime", g_iSaveValue );
}

public CommandPause( iId )
{
new iTeam = get_user_team( iId );

if( 1 <= iTeam <= 2 )
{
if( !g_itechnicalPause[ iTeam - 1 ] )
{
if( !g_bDotechnicalPause )
{
if( !task_exists( TASK_FINISHVOTE ) )
{
new iPlayers[32], szName[32]; g_iNeeded = 0;

get_players( iPlayers, g_iNeeded, "e", g_szTeamNames[iTeam] );

if( g_iNeeded >= MIN_PLAYERS )
{
g_iMenu = menu_create( "take a technical break?", "VoteHandler" );

menu_additem( g_iMenu, "Yes\d, I want" );
menu_additem( g_iMenu, "No\d, cancel" );

menu_addtext( g_iMenu, "^n\r[!]\w Fifteen seconds to vote!" );
menu_setprop( g_iMenu, MPROP_EXIT, MEXIT_NEVER );

for( new i; i < g_iNeeded; i++ )
menu_display( iPlayers, g_iMenu );

get_user_name( iId, szName, charsmax( szName ) );
client_print_color( 0, print_team_default, "^3%s^1 I start a vote for a technical pause!", szName );

g_iVotes = 0;
g_itechnicalPause[ iTeam - 1 ] = floatround( get_gametime( ) );

set_task( 15.0, "FinishVote", TASK_FINISHVOTE );
}
else
client_print_color( iId, print_team_default, "Your team doesn't have enough players to use this." );
}
else
client_print_color( iId, print_team_default, "A vote is already in progress for a technical break." );
}
else
client_print_color( iId, print_team_default, "There is already a technical pause in progress, wait for it to end." );
}
else
client_print_color( iId, print_team_default, "Your team has already voted for a technical break." );
}
else
client_print_color( iId, print_team_default, "You have to be playing to use this command." );

return PLUGIN_HANDLED;
}

public FinishVote( iTaskId )
{
new iTeam = (g_itechnicalPause[0] > g_itechnicalPause[1]) ? 0 : 1;

if( g_iVotes >= g_iNeeded )
{
g_bDotechnicalPause = true;
g_iSaveValue = get_cvar_num( "mp_freezetime" );
set_cvar_num( "mp_freezetime", PAUSE_DURATION );

client_print_color( 0, print_team_default, "The team^3 %s^1 voted for a technical pause.", iTeam > 0 ? "CTerrorists" : "Terrorists" );
client_print_color( 0, print_team_default, "In the next round the waiting time will be^4 %d^1 seconds.", PAUSE_DURATION );
}
else
client_print_color( 0, print_team_default, "The team^3 %s^1 I voted for a technical pause but it was rejected.", iTeam > 0 ? "CTerrorists" : "Terrorists" );

menu_destroy( g_iMenu );
}

public VoteHandler( iId, iMenu, iItem )
{
if( iItem == 0 )
g_iVotes++;

client_cmd( iId, "spk buttons/lightswitch2" );
}


freetime Shuts down In the second round
 

Ayk

Сообщения
763
Реакции
478
Помог
19 раз(а)
Se_IaQe, here is a wrong place for a "do it for me" request. Go to "Buy" section.
 
Статус
В этой теме нельзя размещать новые ответы.

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

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