HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <csdm>
  3. #include <cstrike>
  4. #include <fakemeta>
  5.  
  6. new const g_weapons[] =
  7. {
  8. CSW_P228,
  9. CSW_SCOUT,
  10. CSW_XM1014,
  11. CSW_MAC10,
  12. CSW_AUG,
  13. CSW_ELITE,
  14. CSW_FIVESEVEN,
  15. CSW_UMP45,
  16. CSW_SG550,
  17. CSW_GALI,
  18. CSW_GALIL,
  19. CSW_FAMAS,
  20. CSW_USP,
  21. CSW_GLOCK18,
  22. CSW_AWP,
  23. CSW_MP5NAVY,
  24. CSW_M249,
  25. CSW_M3,
  26. CSW_M4A1,
  27. CSW_TMP,
  28. CSW_G3SG1,
  29. CSW_DEAGLE,
  30. CSW_SG552,
  31. CSW_AK47,
  32. CSW_P90
  33. }
  34.  
  35. new const g_max_clip[] =
  36. {
  37. 13,
  38. 10,
  39. 7,
  40. 30,
  41. 30,
  42. 30,
  43. 20,
  44. 25,
  45. 30,
  46. 35,
  47. 35,
  48. 25,
  49. 12,
  50. 20,
  51. 10,
  52. 30,
  53. 100,
  54. 8,
  55. 30,
  56. 30,
  57. 20,
  58. 7,
  59. 30,
  60. 30,
  61. 50
  62. }
  63.  
  64. new const g_other_weapons[] =
  65. {
  66. CSW_KNIFE,
  67. CSW_HEGRENADE,
  68. CSW_C4
  69. }
  70.  
  71. public plugin_init()
  72. register_plugin("CSDM Refill", "1.0", "Radiance")
  73.  
  74. public client_death(killer, victim, wpnindex, hitplace, TK)
  75. {
  76. if (!csdm_get_ffa() && TK)
  77. return
  78.  
  79. for (new a = 0; a < sizeof (g_other_weapons); a++)
  80. if (wpnindex == g_other_weapons[a])
  81. return
  82.  
  83. new weapon = fm_get_weapon_ent(killer, wpnindex)
  84.  
  85. for (new a = 0; a < sizeof (g_weapons); a++)
  86. if (wpnindex == g_weapons[a])
  87. {
  88. new ammo = get_weapon_maxclip(wpnindex)
  89.  
  90. if (ammo)
  91. {
  92. client_cmd(killer, "spk ^"items/9mmclip1.wav^"")
  93. cs_set_weapon_ammo(weapon, ammo)
  94. }
  95. return
  96.  
  97. }
  98. }
  99.  
  100. get_weapon_maxclip(wpnid = 0)
  101. {
  102. for (new a = 0; a < sizeof (g_weapons); a++)
  103. if (wpnid == g_weapons[a])
  104. return g_max_clip[a]
  105.  
  106. return false
  107. }
  108.  
  109. fm_get_weapon_ent(id, wpnid = 0)
  110. {
  111. new name[32]
  112.  
  113. if(wpnid)
  114. get_weaponname(wpnid, name, 31)
  115.  
  116. if (!equal(name, "weapon_", 7))
  117. format(name, sizeof (name) - 1, "weapon_%s", name)
  118.  
  119. return fm_find_ent_by_owner(get_maxplayers(), name, id)
  120. }
  121.  
  122. fm_find_ent_by_owner(id, const classname[], owner, jghgtype = 0)
  123. {
  124. new strtype[16] = "classname"
  125. new ent = id
  126.  
  127. switch (jghgtype)
  128. {
  129. case 1: strtype = "target"
  130. case 2: strtype = "targetname"
  131. }
  132.  
  133. while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner)
  134. {
  135. }
  136.  
  137. return ent
  138. }
  139.