Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define USE_RULES
- // Includes
- #include < amxmodx >
- #include < cstrike >
- #include < fakemeta_util >
- #include < lastrequest >
- // Defines
- #define LR_MODE LR_CUSTOME_BATTLES // To decide to which category this plugin match
- #define TASKID_DELAY 11111 // Don't touch
- // Enums
- enum _:BATTLE_IDS
- {
- M4A1,
- AK47,
- AWP,
- SCOUT,
- USP,
- M3,
- XM1014,
- M249,
- GALIL,
- AUG,
- FAMAS
- };
- enum _:BATTLE_DATA
- {
- BATTLE_NAME[ 32 ],
- BATTLE_WEAPON_CLASS[ 32 ],
- BATTLE_WEAPON_ID
- };
- // Strings
- new const szBattles[ BATTLE_IDS ][ BATTLE_DATA ] =
- {
- { "M4A1 Battles", "weapon_m4a1", CSW_M4A1 },
- { "AK47 Battles", "weapon_ak47", CSW_AK47 },
- { "AWP Battles", "weapon_awp", CSW_AWP },
- { "SCOUT Battles", "weapon_scout", CSW_SCOUT },
- { "USP Battles", "weapon_usp", CSW_USP },
- { "M3 Battles", "weapon_m3", CSW_M3 },
- { "XM1014 Battles", "weapon_xm1014",CSW_XM1014 },
- { "M249 Battles", "weapon_m249", CSW_M249 },
- { "GALIL Battles", "weapon_galil", CSW_GALIL },
- { "AUG Battles", "weapon_aug", CSW_AUG },
- { "FAMAS Battles", "weapon_famas", CSW_FAMAS }
- };
- // Others
- new g_iBattleIDs[ BATTLE_IDS ];
- new g_mGameID = -1;
- new g_iVictim
- new g_iPlayer;
- public plugin_init()
- {
- register_plugin( "LR: Basic Custome Wars", "1.0", "Rejack" );
- static i, szBuffer[ 32 ];
- for ( i = 0; i < BATTLE_IDS; i++ ) // Register lrs
- {
- formatex( szBuffer, charsmax( szBuffer ), szBattles[ i ][ BATTLE_NAME ] );
- g_iBattleIDs[ i ] = register_custome_lr( szBuffer, true, true, "cmdOpenRulesMenu" );
- if ( g_iBattleIDs[ i ] == -1 )
- log_amx( "[LR:Basic Custome Wars] ERROR: Failed to register custome_lr (i=%i) : %s", i, szBattles[ i ][ BATTLE_NAME ] );
- }
- }
- public cmdOpenRulesMenu( const client )
- {
- set_rule( bNoBunnyhop, false );
- set_rule( bHeadshot, false );
- return cmdSelectRules( client );
- }
- public cmdSelectRules( const client )
- {
- static Menu, szItem[ 128 ];
- formatex( szItem, charsmax( szItem ), "\r[%s]\w Last Request Menu^n^nSelect battle rules!", szPrefix );
- Menu = menu_create( szItem, "handlerSelectRules" );
- formatex( szItem, charsmax( szItem ), "%s:%s", szRules[ bNoBunnyhop ], get_rule( bNoBunnyhop ) ? "\r ON" : "\y OFF" );
- menu_additem( Menu, szItem );
- formatex( szItem, charsmax( szItem ), "%s:%s", szRules[ bHeadshot ], get_rule( bHeadshot ) ? "\r ON" : "\y OFF" );
- menu_additem( Menu, szItem );
- menu_setprop( Menu, MPROP_EXITNAME, "Back" );
- menu_display( client, Menu );
- return 1;
- }
- public handlerSelectRules( client, Menu, Item )
- {
- menu_destroy( Menu );
- switch ( Item )
- {
- case 0:
- set_rule( bNoBunnyhop, !get_rule( bNoBunnyhop ) );
- case 1:
- set_rule( bHeadshot, !get_rule( bHeadshot ) );
- default:
- return userExitRules( client );
- }
- return cmdSelectRules( client );
- }
- public FwdLrStarted( const client, const victim, const g_iCategory, const iGameID, const g_iDelay )
- {
- if ( g_iCategory != LR_MODE ) // Not this category
- return 1;
- static i;
- for ( i = 0; i < BATTLE_IDS; i++ ) // Look to see if the game Id mathces this plugin
- {
- if ( g_iBattleIDs[ i ] == iGameID )
- {
- g_mGameID = i;
- }
- }
- if ( g_mGameID == -1 ) // If didn't match move on
- return 1;
- g_iVictim = victim;
- g_iPlayer = client;
- set_task( float( g_iDelay ), "taskStartBattle", TASKID_DELAY );
- return 1;
- }
- public FwdLrEnded( )
- {
- g_mGameID = -1;
- g_iVictim = 0;
- g_iPlayer = 0;
- if ( task_exists( TASKID_DELAY ) )
- remove_task( TASKID_DELAY );
- return 1;
- }
- public taskStartBattle( )
- {
- fm_give_item( g_iVictim, szBattles[ g_mGameID ][ BATTLE_WEAPON_CLASS ] );
- fm_give_item( g_iVictim, szBattles[ g_mGameID ][ BATTLE_WEAPON_CLASS ] );
- cs_set_user_bpammo( g_iPlayer, szBattles[ g_mGameID ][ BATTLE_WEAPON_ID ], 9999 );
- cs_set_user_bpammo( g_iPlayer, szBattles[ g_mGameID ][ BATTLE_WEAPON_ID ], 9999 );
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement