HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <engine>
  3. #include <hamsandwich>
  4. #include <fakemeta>
  5.  
  6. #define MAX_PLAYERS 32
  7. #define m_afButtonPressed 246
  8.  
  9. new pCvarPluginEnabled
  10.  
  11. new bool:isTryingToBoost[MAX_PLAYERS+1]
  12.  
  13. public plugin_init()
  14. {
  15. new const PluginVersion[] = "1.1"
  16. register_plugin("Run boost", PluginVersion, "EFFx")
  17.  
  18. RegisterHam(Ham_Player_Jump,"player","ham_Player_Jump_Pre",0)
  19.  
  20. pCvarPluginEnabled = register_cvar("runboost_enabled","1")
  21.  
  22. register_touch("player","player","fwd_touch")
  23. }
  24.  
  25. public fwd_touch(PlayerBosting, PlayerReceivingBoost)
  26. {
  27. if(!get_pcvar_num(pCvarPluginEnabled))
  28. return FMRES_IGNORED
  29.  
  30. if(!is_user_alive(PlayerBosting) || !is_user_alive(PlayerReceivingBoost))
  31. return FMRES_IGNORED
  32.  
  33. static Float:fOrigin[2][3]
  34. pev(PlayerBosting, pev_origin, fOrigin[0])
  35. pev(PlayerReceivingBoost, pev_origin, fOrigin[1])
  36.  
  37. new Float:fDistance = fOrigin[1][2] - fOrigin[0][2]
  38. if(fDistance > 51.0)
  39. {
  40. if(get_user_button(PlayerReceivingBoost) & IN_FORWARD)
  41. {
  42. new iSpeed, Float:fVecVelocity[3]
  43. entity_get_vector(PlayerReceivingBoost, EV_VEC_velocity, fVecVelocity)
  44. iSpeed = floatround(vector_length(fVecVelocity))
  45.  
  46. if(iSpeed >= 150)
  47. {
  48. isTryingToBoost[PlayerReceivingBoost] = true
  49. }
  50. }
  51. else
  52. {
  53. isTryingToBoost[PlayerReceivingBoost] = false
  54. }
  55. }
  56. else
  57. {
  58. isTryingToBoost[PlayerReceivingBoost] = false
  59. }
  60. return FMRES_IGNORED
  61. }
  62.  
  63. public ham_Player_Jump_Pre(id)
  64. {
  65. static afButtonPressed; afButtonPressed = get_pdata_int(id, m_afButtonPressed)
  66.  
  67. if(isTryingToBoost[id])
  68. {
  69. if(~afButtonPressed & IN_JUMP)
  70. {
  71. return HAM_IGNORED
  72. }
  73.  
  74. isTryingToBoost[id] = false
  75.  
  76. new Float:fVecVelocity[3]
  77. pev(id,pev_velocity,fVecVelocity)
  78.  
  79. fVecVelocity[0] *= 1.3
  80. fVecVelocity[1] *= 1.3
  81. fVecVelocity[2] *= 1.2
  82.  
  83. set_pev(id, pev_velocity, fVecVelocity)
  84.  
  85. set_pdata_int(id, m_afButtonPressed, afButtonPressed & ~IN_JUMP)
  86. return HAM_SUPERCEDE
  87. }
  88. return HAM_IGNORED
  89. }
  90.