mforce

Freeammo

Nov 6th, 2015
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.12 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <hamsandwich>
  4.  
  5. #include <cstrike_pdatas>
  6.  
  7. #define PLUGIN "Freeammo"
  8. #define VERSION "1.0"
  9.  
  10. enum _:AmmoIds
  11. {
  12.     __ammo_none = 0,
  13.     __ammo_338magnum = 1,    // 30
  14.     __ammo_762nato,            // 90
  15.     __ammo_556natobox,        // 200
  16.     __ammo_556nato,            // 90
  17.     __ammo_buckshot,        // 32
  18.     __ammo_45acp,            // 100
  19.     __ammo_57mm,            // 100
  20.     __ammo_50ae,            // 35
  21.     __ammo_357sig,            // 52
  22.     __ammo_9mm,                // 120
  23.     __ammo_flashbang,        // 2
  24.     __ammo_hegrenade,        // 1
  25.     __ammo_smokegrenade,    // 1
  26.     __ammo_c4                // 1
  27. }
  28.  
  29. new const g_iMaxBpAmmo[AmmoIds] = {
  30.     0,
  31.     30,
  32.     90,
  33.     200,
  34.     90,
  35.     32,
  36.     100,
  37.     100,
  38.     35,
  39.     52,
  40.     120,
  41.     2,
  42.     1,
  43.     1,
  44.     1
  45. }
  46.  
  47. new const g_iMaxClip[CSW_P90+1] = {
  48.     -1,  13, -1, 10,  1,  7,    1, 30, 30,  1,  30,  
  49.         20, 25, 30, 35, 25,   12, 20, 10, 30, 100,  
  50.         8 , 30, 30, 20,  2,    7, 30, 30, -1,  50}
  51.  
  52. public plugin_init()
  53. {
  54.     register_plugin( PLUGIN, VERSION, "ConnorMcLeod" )
  55.  
  56.     RegisterHam(Ham_Spawn, "player", "OnCBasePlayer_Spawn_Post", true)
  57.     register_event("HLTV", "Event_HLTV_New_Round", "a", "1=0", "2=0")
  58.  
  59. }
  60.  
  61. public Event_HLTV_New_Round()
  62. {
  63.     new players[ 32 ], num, id, iWeapon, slot
  64.     get_players(players, num, "a")
  65.     for(--num; num>=0; num--)
  66.     {
  67.         id = players[ num ]
  68.         for(slot = 1; slot<= 2; slot++ )
  69.         {
  70.             iWeapon = get_pdata_cbase(id, m_rgpPlayerItems_CBasePlayer[slot])
  71.             while( iWeapon > 0 )
  72.             {
  73.                 cs_set_weapon_ammo(iWeapon, g_iMaxClip[ cs_get_weapon_id(iWeapon) ])
  74.                 iWeapon = get_pdata_cbase(iWeapon, m_pNext, XO_CBASEPLAYERITEM)
  75.             }
  76.         }
  77.     }
  78. }
  79.  
  80. public OnCBasePlayer_Spawn_Post( id )
  81. {
  82.     if( !is_user_alive(id) ) return;
  83.  
  84.     for(new i=__ammo_338magnum; i<=__ammo_9mm; i++)
  85.     {
  86.         set_pdata_int(id, m_rgAmmo_CBasePlayer[i], g_iMaxBpAmmo[i])
  87.     }
  88. }
Add Comment
Please, Sign In to add comment