AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Orpheu] Player jump power (https://forums.alliedmods.net/showthread.php?t=193852)

DarkGL 08-23-2012 10:14

[Orpheu] Player jump power
 
I want to add some power to user jump ( without changing gavity just velocity )

my code
Code:

OrpheuRegisterHook( OrpheuGetFunctionFromClass("player","Jump","CBasePlayer") , "playerJump" , OrpheuHookPost );
Code:

public playerJump( id ){
       
        new iFlags        =        pev( id , pev_flags );
       
        if( !( pev( id , pev_button ) & IN_JUMP ) || pev( id , pev_oldbuttons ) & IN_JUMP || iFlags & FL_WATERJUMP || pev( id , pev_waterlevel ) >= 2 || !( iFlags & FL_ONGROUND ) ){
                return ;
        }
       
        new Float: fVec[ 3 ];
               
        pev( id , pev_velocity , fVec ) ;
       
        client_print( 0 , 3 , "%f | %f | %f" , fVec[ 0 ] , fVec[ 1 ] , fVec[ 2 ] );
       
        fVec[ 2 ]        +=        floatmul( fVec[ 2 ] , fPercent  ) ;
       
        set_pev( id , pev_velocity , fVec );
}

Code:

{
    "name" : "Jump",
    "class" : "CBasePlayer",
    "library" : "mod",
    "indexes" :
    [
        {
            "os" : "linux",
            "mod" : "cstrike",
            "value" : 78
        }
    ]
}

fVec[ 2 ] is always 0.0 so this code don't work
I know I can calculate it from "sqrt( height * gravity * 2)" but I would want to write it without this
also I know it possible to do it with prethink/postthink but I think Orpheu is more effective

meTaLiCroSS 09-09-2012 16:14

Re: [Orpheu] Player jump power
 
Dump, this seems to be useful and I've trying to search for the same thing D:


All times are GMT -4. The time now is 05:51.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.