Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Includes
- #include < amxmodx >
- #include < cstrike >
- #include < jbGamesAPI >
- #include < fakemeta_util >
- // Defines
- #define ADMIN_ACCESS ADMIN_KICK
- new g_iGame[ 33 ];
- new szItem[ 128 ];
- public plugin_init()
- {
- register_plugin( "Jailbreak: Games", "1.0", "Rejack" );
- register_clcmd( "say /games", "cmdPreMainMenu" );
- }
- public fwGamesWinner( const client )
- {
- fm_set_user_rendering( client, kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 36 ); // Glow
- ColorPrint( 0, "^3%s^1 has won the^4 %s^1 contest.", szName( client ), szEvents[ get_game_type() ] );
- set_hudmessage( 255, 0, 0, -1.0, 0.35, 1, 2.5, 8.0, 0.1, 0.1, 3 );
- show_hudmessage( 0, "%s has won the %s contest!", szName( client ), szEvents[ get_game_type() ] );
- }
- public cmdPreMainMenu( const client )
- {
- if ( cs_get_user_team( client ) == CS_TEAM_CT && is_user_alive( client ) || get_user_flags( client ) & ADMIN_ACCESS )
- {
- if ( g_iGame[ client ] == 0 )
- g_iGame[ client ] = 1;
- return cmdMainMenu( client );
- }
- if ( !is_user_alive( client ) )
- return ColorPrint( client, "You need to be alive." );
- return ColorPrint( client, "You don't have access to this menu." );
- }
- public cmdMainMenu( const client )
- {
- if ( cs_get_user_team( client ) == CS_TEAM_CT && is_user_alive( client ) || get_user_flags( client ) & ADMIN_ACCESS )
- {
- static Menu;
- formatex( szItem, charsmax( szItem ), "\r[%s]\w Jailbreak Games", szPrefix );
- Menu = menu_create( szItem, "handlerMainMenu" );
- formatex( szItem, charsmax( szItem ), "Select a Game:\r %s", szEvents[ g_iGame[ client ] ] );
- menu_additem( Menu, szItem );
- formatex( szItem, charsmax( szItem ), "%s%s\w Game", is_game_active() ? "\r" : "\y", is_game_active() ? "Stop" : "Start" );
- menu_additem( Menu, szItem );
- menu_display( client, Menu );
- return 1;
- }
- if ( !is_user_alive( client ) )
- return ColorPrint( client, "You need to be alive." );
- return ColorPrint( client, "You don't have access to this menu." );
- }
- public handlerMainMenu( client, Menu, Item )
- {
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return 1;
- }
- if ( cs_get_user_team( client ) == CS_TEAM_CT && is_user_alive( client ) || get_user_flags( client ) & ADMIN_ACCESS )
- {
- if ( Item == 0 ) // Switch games
- return cmdSelectGameMenu( client );
- if ( Item == 1 ) // Stop\Start games
- {
- if ( is_game_active() )
- {
- ColorPrint( 0, "^3%s^1 has stopped the^4 %s^1 contest.", szName( client ), szEvents[ get_game_type() ] );
- end_game( END_STOP );
- }
- else
- {
- start_game( g_iGame[ client ] );
- ColorPrint( 0, "^3%s^1 has started a^4 %s^1 contest.", szName( client ), szEvents[ get_game_type() ] );
- }
- }
- return cmdMainMenu( client );
- }
- if ( !is_user_alive( client ) )
- return ColorPrint( client, "You need to be alive." );
- return ColorPrint( client, "You don't have access to this menu." );
- }
- public cmdSelectGameMenu( const client )
- {
- static Menu, i;
- formatex( szItem, charsmax( szItem ), "\r[%s]\w Jailbreak Games^n^nSelect a Game", szPrefix );
- Menu = menu_create( szItem, "handlerSelectGameMenu" );
- for ( i = 1; i < sizeof szEvents; i++ )
- menu_additem( Menu, szEvents[ i ] );
- menu_setprop( Menu, MPROP_EXITNAME, "Back" );
- menu_display( client, Menu );
- return 1;
- }
- public handlerSelectGameMenu( client, Menu, Item )
- {
- if ( Item == MENU_EXIT )
- {
- menu_destroy( Menu );
- return cmdMainMenu( client );
- }
- g_iGame[ client ] = Item + 1;
- return cmdMainMenu( client );
- }
Advertisement
Add Comment
Please, Sign In to add comment