HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <hamsandwich>
  3. #include <fakemeta>
  4. #include <xs>
  5.  
  6. #define MAX_PLAYERS 32
  7.  
  8. enum
  9. {
  10. normal,
  11. slower,
  12. medium
  13. }
  14.  
  15. const m_pPlayer = 41
  16. const XoCGrenade = 4
  17.  
  18. new const GrenadeClassNames[][] =
  19. {
  20. "weapon_flashbang",
  21. "weapon_hegrenade",
  22. "weapon_smokegrenade"
  23. }
  24.  
  25. new const Float:VelocityMultiplier[] =
  26. {
  27. 1.0,
  28. 0.5,
  29. 0.7
  30. }
  31.  
  32. new HandleThrowType[MAX_PLAYERS+1]
  33.  
  34. public plugin_init()
  35. {
  36. new const PluginVersion[] = "1.1"
  37. register_plugin("Pop Grenades",PluginVersion,"EFFx/HamletEagle")
  38.  
  39. register_event("CurWeapon", "event_CurWeapon", "be", "1=1")
  40.  
  41. for(new i; i < sizeof GrenadeClassNames; i++)
  42. {
  43. RegisterHam(Ham_Weapon_SecondaryAttack, GrenadeClassNames[i], "CBasePlayerWpn_SecondaryAttack", false)
  44. }
  45. }
  46.  
  47. public event_CurWeapon(id)
  48. {
  49. HandleThrowType[id] = normal
  50. }
  51.  
  52. public CBasePlayerWpn_SecondaryAttack(const grenadeEntity)
  53. {
  54. if(pev_valid(grenadeEntity))
  55. {
  56. new id = get_pdata_cbase(grenadeEntity, m_pPlayer, XoCGrenade)
  57. new buttons = pev(id, pev_button)
  58.  
  59. if(buttons & IN_ATTACK)
  60. {
  61. HandleThrowType[id] = medium
  62. }
  63. else
  64. {
  65. HandleThrowType[id] = slower
  66. }
  67.  
  68. ExecuteHamB(Ham_Weapon_PrimaryAttack, grenadeEntity)
  69. }
  70. }
  71.  
  72. public grenade_throw(id, grenadeEntity, grenadeWeaponIndex)
  73. {
  74. if(pev_valid(grenadeEntity))
  75. {
  76. new Float:grenadeVelocity[3]
  77. pev(grenadeEntity, pev_velocity, grenadeVelocity)
  78.  
  79. new Float:multiplier = VelocityMultiplier[HandleThrowType[id]]
  80. xs_vec_mul_scalar(grenadeVelocity, multiplier, grenadeVelocity)
  81. set_pev(grenadeEntity, pev_velocity, grenadeVelocity)
  82.  
  83. HandleThrowType[id] = normal
  84. }
  85. }
  86.