Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Plugin generated by AMXX-Studio */
- #include < amxmodx >
- #include < fakemeta >
- #include < cstrike >
- #define MAX_SECONDS 90
- #define COUNT_TASK 17
- new const szTeams_Freeze [ ] [ ] =
- {
- "All Team's",
- "Terrorist's",
- "Counter Terrorist's",
- "None"
- }
- new iSound[ 33 ], iVoice[ 33 ], iFreeze[ 33 ], iSeconds[ 33 ] = 5, Countdown_Time, gCountStarted;
- public plugin_init()
- {
- register_plugin( "Countdown Menu", "1.0", "Doctor Who ?" );
- register_clcmd( "say /cd", "Countdown_Menu" );
- }
- public Countdown_Menu( client )
- {
- if( !is_user_alive( client ) )
- return ColorChat( client, "^4%s^1 You ^3need ^1to be ^4alive^1 to ^4use^1 this ^3command^1.", GetUserName( client ) )
- if( cs_get_user_team( client ) != CS_TEAM_CT )
- return ColorChat( client, "^4%s^1 You ^4need^1 to ^4be^1 a ^3counter ^1- ^3terrorist ^1alive ^3player. ", GetUserName( client ) );
- new szText[ 192 ];
- formatex( szText, charsmax( szText ), "\d[ \yAMXX\d ] \wCountdown Menu\d:" );
- new Menu = menu_create( szText, "Countdown_Handler" );
- formatex( szText, charsmax( szText ), "\wCountdown Seconds - \d%i", iSeconds[ client ] );
- menu_additem( Menu, szText );
- formatex( szText, charsmax( szText ), "\wCountdown Freeze - \d%s", szTeams_Freeze[ iFreeze[ client ] ] );
- menu_additem( Menu, szText );
- formatex( szText, charsmax( szText ), "\wCountdown Sound - \d%s", iSound[ client ] ? "ON" : "OFF" );
- menu_additem( Menu, szText );
- formatex( szText, charsmax( szText ), "\wCountdown Voice - \d%s", iVoice[ client ] ? "Male" : "Female" );
- menu_additem( Menu, szText );
- formatex( szText, charsmax( szText ), "\w%s the Countdown.", gCountStarted ? "Stop" : "Start" );
- menu_display( client, Menu, 0 );
- return 1;
- }
- public Countdown_Handler( client, Menu, Item )
- {
- if( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return 1;
- }
- switch( Item )
- {
- case 0:
- {
- if( iSeconds[ client ] >= MAX_SECONDS )
- iSeconds[ client ] = 5;
- else
- iSeconds[ client ] += 5;
- }
- case 1:
- {
- if( iFreeze[ client ] >= sizeof( szTeams_Freeze ) -1 )
- iFreeze[ client ] = 0;
- else
- iFreeze[ client ] += 1;
- }
- case 2: iSound[ client ] = !iSound[ client ];
- case 3: iVoice[ client ] = !iVoice[ client ];
- case 4:
- {
- if( gCountStarted )
- {
- ColorChat( 0, "^4%s^1 has ^4stopped^1 the ^3countdown.", GetUserName( client ) );
- gCountStarted = false;
- remove_task( COUNT_TASK );
- for( new i; i < get_maxplayers(); i++ )
- {
- if( !is_user_connected( i ) )
- continue;
- set_user_freeze( i, 0 );
- }
- }
- gCountStarted = true;
- Countdown_Time = iSeconds[ client ];
- set_task( 1.0, "CmdCountdown", client + COUNT_TASK, _,_, "b" );
- FreezePlayers( client );
- return menu_destroy( Menu );
- }
- }
- return Countdown_Menu( client );
- }
- public FreezePlayers( client )
- {
- for( new i = 0; i < get_maxplayers(); i++ )
- {
- if( !is_user_alive( i ) )
- continue;
- switch( iFreeze[ client ] )
- {
- case 0: set_user_freeze( i, 1 );
- case 1: if( cs_get_user_team( i ) == CS_TEAM_T ) set_user_freeze( i, 1 );
- case 2: if( cs_get_user_team( i ) == CS_TEAM_CT ) set_user_freeze( i, 1 );
- case 3: set_user_freeze( i, 0 );
- }
- }
- }
- public CmdCountdown( client )
- {
- if( Countdown_Time <= 0 )
- {
- for( new i; i < get_maxplayers(); i++ )
- {
- if( !is_user_connected( i ) )
- continue;
- set_user_freeze( i, 0 );
- }
- gCountStarted = false;
- ColorChat( 0, "The ^3Countdown has ^3ended." );
- remove_task( COUNT_TASK );
- }
- set_hudmessage( 0, 255, 255, -1.0, 0.46, 0, 6.0, 1.0 )
- show_hudmessage( 0, "Countdown have left %i seconds", Countdown_Time )
- Countdown_Time -= 1;
- if( Countdown_Time < 21 && iSound[ client ] )
- {
- new szVox[ 10 ];
- num_to_word( Countdown_Time, szVox, charsmax( szVox ) );
- if( iVoice[ client ] ) client_cmd( 0, "spk ^"vox/%s^"", szVox );
- if( !iVoice[ client ] ) client_cmd( 0, "spk ^"fvox/%s^"", szVox );
- }
- }
- stock GetUserName( index )
- {
- new szName[ 32 ];
- get_user_name( index, szName, charsmax( szName ) );
- return szName;
- }
- stock set_user_freeze( index, freeze )
- {
- new iFlag = pev( index, pev_flags );
- set_pev( index, pev_flags, freeze ? iFlag | FL_FROZEN : iFlag & ~FL_FROZEN );
- }
- stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...)
- {
- new msg[191], players[32], count = 1
- static len
- len = formatex(msg, charsmax(msg), "^1[ ^4Countdown - System^1 ] ")
- vformat(msg[len], charsmax(msg) - len, string, 3)
- if(id) players[0] = id
- else get_players(players,count,"ch")
- for (new i = 0; i < count; i++)
- {
- if(is_user_connected(players[i]))
- {
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i])
- write_byte(players[i])
- write_string(msg)
- message_end()
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment