Advertisement
Guest User

Untitled

a guest
Apr 5th, 2011
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <hlsdk_const>
  3. #include <orpheu_stocks>
  4. #include <xs>
  5.  
  6. new const VERSION[] = "0.0.1"
  7.  
  8. new OrpheuFunction:OfCheckVelocity;
  9. new OrpheuStruct:ppmove;
  10.  
  11. //new g_pCvarJumpZvelocityValue
  12.  
  13. public plugin_init()
  14. {
  15. register_plugin("Jump", VERSION, "ConnorMcLeod")
  16.  
  17. OrpheuRegisterHook(OrpheuGetDLLFunction("pfnPM_Move","PM_Move"), "OnPM_Move");
  18. OrpheuRegisterHook(OrpheuGetFunction("PM_Jump"), "OnPM_Jump")
  19.  
  20. OfCheckVelocity = OrpheuGetFunction("PM_CheckVelocity")
  21.  
  22. //g_pCvarJumpZvelocityValue = register_cvar("jump_velocity", "350")
  23. }
  24.  
  25. public OrpheuHookReturn:OnPM_Move(OrpheuStruct:pmove, server)
  26. {
  27. ppmove = pmove;
  28. }
  29.  
  30. public OrpheuHookReturn:OnPM_Jump()
  31. {
  32. if( OrpheuGetStructMember(ppmove, "dead")
  33. || OrpheuGetStructMember(ppmove, "waterjumptime")
  34. || OrpheuGetStructMember(ppmove, "waterlevel")
  35. || OrpheuGetStructMember(ppmove, "onground") == -1
  36. || (OrpheuGetStructMember(ppmove, "oldbuttons") & IN_JUMP) )
  37. {
  38. return OrpheuIgnored
  39. }
  40.  
  41. OrpheuSetStructMember(ppmove, "onground", -1)
  42.  
  43. new Float:fVecVelocity[3]
  44. OrpheuGetStructMember(ppmove, "velocity", fVecVelocity)
  45.  
  46. new Float:maxscaledspeed = 1.2 * Float:OrpheuGetStructMember(ppmove, "maxspeed")
  47.  
  48. if ( maxscaledspeed > 0.0 )
  49. {
  50. new Float:spd = vector_length(fVecVelocity)
  51. if ( spd > maxscaledspeed )
  52. {
  53. new Float:fraction = ( maxscaledspeed / spd ) * ( 0.99 + random_float( 0.0020, 0.0045 ) );
  54. xs_vec_mul_scalar(fVecVelocity, fraction, fVecVelocity)
  55. }
  56. }
  57.  
  58. new Float:flGravity = Float:OrpheuGetStructMember(ppmove, "gravity")
  59. if( !flGravity )
  60. {
  61. flGravity = 1.0
  62. }
  63. /*
  64. fVecVelocity[2] =
  65. get_pcvar_float(g_pCvarJumpZvelocityValue)
  66. - ( flGravity
  67. * Float:OrpheuGetStructMember(OrpheuStruct:OrpheuGetStructMember(ppmove, "movevars"), "gravity")
  68. * Float:OrpheuGetStructMember(ppmove, "frametime")
  69. * 0.5
  70. )
  71. */
  72. fVecVelocity[2] = floatsqroot( 2 * 800 * 45.0 );
  73.  
  74. if( Float:OrpheuGetStructMember(ppmove, "fuser2") > 0.0 )
  75. {
  76. fVecVelocity[2] *= ( 100.0 - Float:OrpheuGetStructMember(ppmove, "fuser2") * 0.001 * 19.0 ) * 0.01;
  77. }
  78.  
  79. OrpheuSetStructMember(ppmove, "velocity", fVecVelocity)
  80. OrpheuCall(OfCheckVelocity)
  81.  
  82. OrpheuSetStructMember(ppmove, "fuser2", /*Float:OrpheuGetStructMember(ppmove, "fuser2") +*/ 1315.7894)
  83. OrpheuSetStructMember(ppmove, "oldbuttons", OrpheuGetStructMember(ppmove, "oldbuttons") | IN_JUMP)
  84.  
  85. return OrpheuSupercede
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement