Rejack

Basic Custome Wars addon for LR API

Jan 17th, 2017 (edited)
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.56 KB | None | 0 0
  1. // Includes
  2.  
  3. #include < amxmodx >
  4. #include < cstrike >
  5. #include < fakemeta_util >
  6. #include < lastrequest >
  7.  
  8. // Defines
  9.  
  10. #define LR_MODE     LR_CUSTOME_BATTLES      // To decide to which category this plugin match
  11.  
  12. #define TASKID_DELAY    11111   // Don't touch
  13.  
  14. // Enums
  15.  
  16. enum _:BATTLE_IDS
  17. {
  18.     M4A1,
  19.     AK47,
  20.     AWP,
  21.     SCOUT,
  22.     USP,
  23.     M3,
  24.     XM1014,
  25.     M249,
  26.     GALIL,
  27.     AUG,
  28.     FAMAS
  29. };
  30.  
  31. enum _:BATTLE_DATA
  32. {
  33.     BATTLE_NAME[ 32 ],
  34.     BATTLE_WEAPON_CLASS[ 32 ],
  35.     BATTLE_WEAPON_ID
  36. };
  37.  
  38. // Strings
  39.  
  40. new const szBattles[ BATTLE_IDS ][ BATTLE_DATA ] =
  41. {
  42.     { "M4A1 Battles",   "weapon_m4a1",  CSW_M4A1 },
  43.     { "AK47 Battles",   "weapon_ak47",  CSW_AK47 },
  44.     { "AWP Battles",    "weapon_awp",   CSW_AWP },
  45.     { "SCOUT Battles",  "weapon_scout", CSW_SCOUT },
  46.     { "USP Battles",    "weapon_usp",   CSW_USP },
  47.     { "M3 Battles",     "weapon_m3",    CSW_M3 },
  48.     { "XM1014 Battles", "weapon_xm1014",CSW_XM1014 },
  49.     { "M249 Battles",   "weapon_m249",  CSW_M249 },
  50.     { "GALIL Battles",  "weapon_galil", CSW_GALIL },
  51.     { "AUG Battles",    "weapon_aug",   CSW_AUG },
  52.     { "FAMAS Battles",  "weapon_famas", CSW_FAMAS }
  53. };
  54.  
  55. // Others
  56.  
  57. new g_iBattleIDs[ BATTLE_IDS ];
  58.  
  59. new g_mGameID   = -1;
  60.  
  61. new g_iVictim
  62. new g_iPlayer;
  63.  
  64. public plugin_init()
  65. {
  66.     register_plugin( "LR: Basic Custome Wars", "1.0", "Rejack" );
  67.    
  68.     static i, szBuffer[ 32 ];
  69.    
  70.     for ( i = 0; i < BATTLE_IDS; i++ )  // Register lrs
  71.     {
  72.         formatex( szBuffer, charsmax( szBuffer ), szBattles[ i ][ BATTLE_NAME ] );
  73.        
  74.         g_iBattleIDs[ i ]   = register_custome_lr( szBuffer, true );
  75.     }
  76. }
  77.  
  78. public FwdLrStarted( const client, const victim, const g_iCategory, const iGameID, const g_iDelay )
  79. {
  80.     if ( g_iCategory != LR_MODE )   // Not this category
  81.         return 1;
  82.    
  83.     static i;
  84.    
  85.     for ( i = 0; i < BATTLE_IDS; i++ )      // Look to see if the game Id mathces this plugin
  86.     {
  87.         if ( g_iBattleIDs[ i ] == iGameID )
  88.         {
  89.             g_mGameID   = i;
  90.         }
  91.     }
  92.    
  93.     if ( g_mGameID == -1 )  // If didn't match move on
  94.         return 1;
  95.    
  96.     g_iVictim   = victim;
  97.     g_iPlayer   = client;
  98.    
  99.     set_task( float( g_iDelay ), "taskStartBattle", TASKID_DELAY );
  100.    
  101.     return 1;
  102. }
  103.  
  104. public FwdLrEnded( )
  105. {
  106.     g_mGameID   = -1;
  107.    
  108.     g_iVictim   = 0;
  109.     g_iPlayer   = 0;
  110.    
  111.     if ( task_exists( TASKID_DELAY ) )
  112.         remove_task( TASKID_DELAY );
  113.    
  114.     return 1;
  115. }
  116.  
  117. public taskStartBattle( )
  118. {
  119.     fm_give_item( g_iVictim, szBattles[ g_mGameID ][ BATTLE_WEAPON_CLASS ] );
  120.    
  121.     fm_give_item( g_iVictim, szBattles[ g_mGameID ][ BATTLE_WEAPON_CLASS ] );
  122.    
  123.     cs_set_user_bpammo( g_iPlayer, szBattles[ g_mGameID ][ BATTLE_WEAPON_ID ], 9999 );
  124.    
  125.     cs_set_user_bpammo( g_iPlayer, szBattles[ g_mGameID ][ BATTLE_WEAPON_ID ], 9999 );
  126.    
  127.     return 1;
  128. }
Advertisement
Add Comment
Please, Sign In to add comment