Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include < amxmodx >
- #include < cstrike >
- #include < hamsandwich >
- #include < fakemeta_util >
- enum _:g_mData
- {
- g_mName[ 32 ],
- g_mClass[ 32 ],
- g_mIndex,
- g_mAmmo
- };
- new szPrimary[ ][ g_mData ] =
- {
- { "M4A1", "weapon_m4a1", CSW_M4A1, 120 },
- { "AK47", "weapon_ak47", CSW_AK47, 120 },
- { "GALIL", "weapon_galil", CSW_GALIL, 120 },
- { "FAMAS", "weapon_famas", CSW_FAMAS, 120 },
- { "M249", "weapon_m249", CSW_M249, 400 },
- { "MP5NAVY", "weapon_mp5navy", CSW_MP5NAVY, 120 },
- { "AWP", "weapon_awp", CSW_AWP, 70 },
- { "SCOUT", "weapon_scout", CSW_SCOUT, 120 },
- { "M3", "weapon_m3", CSW_M3, 80 }
- };
- new szSecondary[ ][ g_mData ] =
- {
- { "GLOCK", "weapon_glock18", CSW_GLOCK18, 200 },
- { "USP", "weapon_usp", CSW_USP, 100 },
- { "DEAGLE", "weapon_deagle", CSW_DEAGLE, 70 },
- { "FIVESEVEN", "weapon_fiveseven", CSW_FIVESEVEN, 200 }
- };
- new szPrefix[ ] = "Prefix";
- new Float:iCount[ 33 ], bool: bValid[ 33 ], pCvar[ 2 ], iPrimary[ 33 ], iSecondary[ 33 ];
- public plugin_init()
- {
- register_plugin( "Guards Weapons Menu", "1.4", "Rejack" );
- register_clcmd( "say /guns", "CmdSayGuns" );
- RegisterHam( Ham_Spawn, "player", "HamSpawnPost", 1 );
- pCvar[ 0 ] = register_cvar( "gw_toggle", "1" );
- pCvar[ 1 ] = register_cvar( "gw_timer", "15" );
- }
- public CmdSayGuns( client )
- {
- bValid[ client ] = !bValid[ client ];
- client_print( client, print_chat, "Your weapons menu is now: %sabled, type /guns to %sable.", bValid[ client ] ? "Dis" : "En", bValid[ client ] ? "en" : "dis" );
- return 1;
- }
- public HamSpawnPost( client )
- {
- if ( !is_user_alive( client ) || !is_user_connected( client ) || cs_get_user_team( client ) != CS_TEAM_CT || !get_pcvar_num( pCvar[ 0 ] ) )
- return 1;
- remove_task( client );
- iCount[ client ] = get_gametime();
- if ( !bValid[ client ] )
- set_task( 1.0, "CmdShowMenu", client, _,_, "a", get_pcvar_num( pCvar[ 1 ] ) );
- else if ( bValid[ client ] )
- GiveItems( client );
- return 1;
- }
- public CmdShowMenu( client )
- {
- show_menu( client, 0, "^n", 1 );
- if ( !is_user_alive( client ) || !is_user_connected( client ) || cs_get_user_team( client ) != CS_TEAM_CT || !get_pcvar_num( pCvar[ 0 ] ) )
- return 1;
- if ( iCount[ client ] + get_pcvar_num( pCvar[ 1 ] ) < get_gametime() )
- {
- GiveItems( client );
- return 1;
- }
- static szItem[ 128 ];
- formatex( szItem, charsmax( szItem ), "\r[%s]\w Guards Weapons Menu^n\r%i\d Seconds!", szPrefix, get_pcvar_num( pCvar[ 1 ] ) - floatround( (iCount[client]-get_gametime()) / (-1) ) );
- new Menu = menu_create( szItem, "SubShowMenu" );
- formatex( szItem, charsmax( szItem ), "Primary Weapon\d: [\r %s \d]", szPrimary[ iPrimary[ client ] ] );
- menu_additem( Menu, szItem );
- formatex( szItem, charsmax( szItem ), "Secondary Weapon\d: [\r %s \d]", szSecondary[ iSecondary[ client ] ] );
- menu_additem( Menu, szItem );
- menu_addblank( Menu, 0 );
- menu_additem( Menu, "\rOrder Package" );
- menu_addblank( Menu, 0 );
- formatex( szItem, charsmax( szItem ), "Weapons Menu\d: [\r %s \d]", bValid[ client ] ? "Disabled" : "Enabled" );
- menu_additem( Menu, szItem );
- menu_display( client, Menu );
- return 1;
- }
- public SubShowMenu( client, Menu, Item )
- {
- if ( !is_user_alive( client ) || !is_user_connected( client ) || cs_get_user_team( client ) != CS_TEAM_CT || !get_pcvar_num( pCvar[ 0 ] ) )
- return 1;
- switch ( Item )
- {
- case 0:
- {
- if ( iPrimary[ client ] == charsmax( szPrimary ) )
- iPrimary[ client ] = -1;
- iPrimary[ client ]++;
- return CmdShowMenu( client );
- }
- case 1:
- {
- if ( iSecondary[ client ] == charsmax( szSecondary ) )
- iSecondary[ client ] = -1;
- iSecondary[ client ]++;
- return CmdShowMenu( client );
- }
- case 2,MENU_EXIT:
- {
- GiveItems( client );
- return 1;
- }
- case 3:
- {
- bValid[ client ] = !bValid[ client ];
- client_print( client, print_chat, "Your weapons menu is now: %sabled, type /guns to %s", bValid[ client ] ? "Dis" : "En", bValid[ client ] ? "enable" : "disable" );
- return CmdShowMenu( client );
- }
- }
- menu_destroy( Menu );
- return 1;
- }
- stock GiveItems( const index )
- {
- if ( task_exists( index ) )
- remove_task( index );
- fm_strip_user_weapons( index );
- fm_give_item( index, szPrimary[ iPrimary[ index ] ][ g_mClass ] );
- fm_give_item( index, szSecondary[ iSecondary[ index ] ][ g_mClass ] );
- fm_give_item( index, "weapon_knife" );
- fm_give_item( index, "weapon_hegrenade" );
- fm_give_item( index, "weapon_smokegrenade" );
- cs_set_user_bpammo( index, szPrimary[ iPrimary[ index ] ][ g_mIndex ], szPrimary[ iPrimary[ index ] ][ g_mAmmo ] );
- cs_set_user_bpammo( index, szSecondary[ iSecondary[ index ] ][ g_mIndex ], szSecondary[ iSecondary[ index ] ][ g_mAmmo ] );
- cs_set_user_bpammo( index, CSW_SMOKEGRENADE, 4 );
- if ( bValid[ index ] )
- client_print( index, print_chat, "Your guns menu is disabled, type /guns to enable." );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement