Raised This Month: $32 Target: $400
 8% 

Slow motion


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Point
Junior Member
Join Date: Oct 2014
Old 06-25-2019 , 08:59   Slow motion
Reply With Quote #1

PHP Code:
/* Script generated by Pawn Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <xs>

#define PLUGIN    "Slowmotion"
#define AUTHOR    "DarkGL"
#define VERSION    "1.0"

#define MAX 32

new boolbSlowMAX ] ,
    
FloatoldVelocMAX ][ ] ,
    
FloatfTimeMAX ] ,
    
pGrav ,
    
pSlowSpeed ;
    
new const 
Float:g_fWeaponsSpeed[ ]={
    
000.0,
    
250.0000.0260.0250.0240.0
    
250.0250.0240.0250.0250.0,                
    
250.0250.0210.0240.0240.0,    
    
250.0250.0210.0250.0220.0,              
    
230.0230.0250.0210.0250.0,            
    
250.0235.0221.0250.0245.0 
};

public 
plugin_init(){
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd"say /slow" "voidSlow" );
    
    
pGrav        =    get_cvar_pointer"sv_gravity" );
    
pSlowSpeed    =    register_cvar"amx_slowmo" "0.3" );
}

public 
client_connectid ){
    
bSlowid ]    =    false;
}

public 
voidSlowid ){
    
    
bSlowid ]    =    !bSlowid ];
    
    if( 
bSlowid ] ){
        
pevid pev_velocity oldVelocid ] );
        
fTimeid ]    =    get_gametime();
    }
    else{
        
engfuncEngFunc_SetClientMaxspeed id g_fWeaponsSpeedget_user_weaponid ) ] );
    }
    
    return 
PLUGIN_HANDLED;
}

public 
client_PreThinkid ){
    if( !
is_user_aliveid ) || !bSlowid ] ){
        return 
PLUGIN_CONTINUE;
    }
    
    new 
FloatfVeloc] ,
        
FloatfOrigin] ,
        
FloatSLOW_SPEED ;
    
    
SLOW_SPEED    =    get_pcvar_floatpSlowSpeed );
        
    
pevid pev_origin fOrigin );
    
pevid pev_velocity ,fVeloc  );
    
    if( !( -
0.01 <= fVeloc] - oldVelocid ][ ] <= 0.01 ) ){
        
fVeloc] -=    oldVelocid ][ ];
        
fVeloc]    *= SLOW_SPEED;
        
        
oldVelocid ][ ] += fVeloc];
    }
    if( !( -
0.01 <= fVeloc] - oldVelocid ][ ] <= 0.01 ) ){
        
fVeloc] -=    oldVelocid ][ ];
        
fVeloc]    *= SLOW_SPEED;
        
        
oldVelocid ][ ] += fVeloc];
    }
    
    new 
FloatfTimeSub    =    get_gametime() - fTimeid ];
    
    
fTimeid ]    =    get_gametime();
    
    
fOrigin]    -=    floatmulfVeloc] , fTimeSub );
    
fOrigin]    +=    floatmulfVeloc] , fTimeSub SLOW_SPEED );
    
    if( !( 
pevid pev_flags ) & FL_ONGROUND ) && ! ( pevid pev_flags ) & FL_PARTIALGROUND ) ){
        
        
fVeloc] +=    floatmulpevid pev_gravity ) * get_pcvar_floatpGrav ) , fTimeSub );
        
fVeloc]    -=    floatmulpevid pev_gravity ) * get_pcvar_floatpGrav ) , fTimeSub SLOW_SPEED );
    }
    
    
oldVelocid ][ ]    =    fVeloc];
    
    
fTimeid ]    =    get_gametime();
    
    
engfuncEngFunc_SetOrigin id fOrigin );
    
set_pevid pev_velocity oldVelocid ] );
    
set_pevid pev_framerate SLOW_SPEED );
    
    
engfuncEngFunc_SetClientMaxspeed id g_fWeaponsSpeedget_user_weaponid ) ] * SLOW_SPEED );
    
    return 
PLUGIN_CONTINUE;

Is there any better way? maybe using reapi or so. This plugins works but sometimes players fall through map
Point is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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