Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <hlsdk_const>
- #include <orpheu_stocks>
- #include <xs>
- new const VERSION[] = "0.0.1"
- new OrpheuFunction:OfCheckVelocity;
- new OrpheuStruct:ppmove;
- //new g_pCvarJumpZvelocityValue
- public plugin_init()
- {
- register_plugin("Jump", VERSION, "ConnorMcLeod")
- OrpheuRegisterHook(OrpheuGetDLLFunction("pfnPM_Move","PM_Move"), "OnPM_Move");
- OrpheuRegisterHook(OrpheuGetFunction("PM_Jump"), "OnPM_Jump")
- OfCheckVelocity = OrpheuGetFunction("PM_CheckVelocity")
- //g_pCvarJumpZvelocityValue = register_cvar("jump_velocity", "350")
- }
- public OrpheuHookReturn:OnPM_Move(OrpheuStruct:pmove, server)
- {
- ppmove = pmove;
- }
- public OrpheuHookReturn:OnPM_Jump()
- {
- if( OrpheuGetStructMember(ppmove, "dead")
- || OrpheuGetStructMember(ppmove, "waterjumptime")
- || OrpheuGetStructMember(ppmove, "waterlevel")
- || OrpheuGetStructMember(ppmove, "onground") == -1
- || (OrpheuGetStructMember(ppmove, "oldbuttons") & IN_JUMP) )
- {
- return OrpheuIgnored
- }
- OrpheuSetStructMember(ppmove, "onground", -1)
- new Float:fVecVelocity[3]
- OrpheuGetStructMember(ppmove, "velocity", fVecVelocity)
- new Float:maxscaledspeed = 1.2 * Float:OrpheuGetStructMember(ppmove, "maxspeed")
- if ( maxscaledspeed > 0.0 )
- {
- new Float:spd = vector_length(fVecVelocity)
- if ( spd > maxscaledspeed )
- {
- new Float:fraction = ( maxscaledspeed / spd ) * ( 0.99 + random_float( 0.0020, 0.0045 ) );
- xs_vec_mul_scalar(fVecVelocity, fraction, fVecVelocity)
- }
- }
- new Float:flGravity = Float:OrpheuGetStructMember(ppmove, "gravity")
- if( !flGravity )
- {
- flGravity = 1.0
- }
- /*
- fVecVelocity[2] =
- get_pcvar_float(g_pCvarJumpZvelocityValue)
- - ( flGravity
- * Float:OrpheuGetStructMember(OrpheuStruct:OrpheuGetStructMember(ppmove, "movevars"), "gravity")
- * Float:OrpheuGetStructMember(ppmove, "frametime")
- * 0.5
- )
- */
- fVecVelocity[2] = floatsqroot( 2 * 800 * 45.0 );
- if( Float:OrpheuGetStructMember(ppmove, "fuser2") > 0.0 )
- {
- fVecVelocity[2] *= ( 100.0 - Float:OrpheuGetStructMember(ppmove, "fuser2") * 0.001 * 19.0 ) * 0.01;
- }
- OrpheuSetStructMember(ppmove, "velocity", fVecVelocity)
- OrpheuCall(OfCheckVelocity)
- OrpheuSetStructMember(ppmove, "fuser2", /*Float:OrpheuGetStructMember(ppmove, "fuser2") +*/ 1315.7894)
- OrpheuSetStructMember(ppmove, "oldbuttons", OrpheuGetStructMember(ppmove, "oldbuttons") | IN_JUMP)
- return OrpheuSupercede
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement