AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   SlowMotion (https://forums.alliedmods.net/showthread.php?t=223006)

Jhob94 08-08-2013 19:43

SlowMotion
 
Is there anyway to make slow motion game for 5 seconds every 10 minutes? Or will i have to change player speed and weapon speed?

ironskillz1 08-08-2013 20:14

Re: SlowMotion
 
Found this but im on my phone right know. I think you got knowledge to Edit it
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 bool: bSlow[ MAX + 1 ] ,
        Float: oldVeloc[ MAX + 1 ][ 3 ] ,
        Float: fTime[ MAX + 1 ] ,
        pGrav ,
        pSlowSpeed ;
       
new const Float:g_fWeaponsSpeed[ ]={
        000.0,
        250.0, 000.0, 260.0, 250.0, 240.0,
        250.0, 250.0, 240.0, 250.0, 250.0,               
        250.0, 250.0, 210.0, 240.0, 240.0,   
        250.0, 250.0, 210.0, 250.0, 220.0,             
        230.0, 230.0, 250.0, 210.0, 250.0,           
        250.0, 235.0, 221.0, 250.0, 245.0
};

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

public client_connect( id ){
        bSlow[ id ]        =        false;
}

public voidSlow( id ){
       
        bSlow[ id ]        =        !bSlow[ id ];
       
        if( bSlow[ id ] ){
                pev( id , pev_velocity , oldVeloc[ id ] );
                fTime[ id ]        =        get_gametime();
        }
        else{
                engfunc( EngFunc_SetClientMaxspeed , id , g_fWeaponsSpeed[ get_user_weapon( id ) ] );
        }
       
        return PLUGIN_HANDLED;
}

public client_PreThink( id ){
        if( !is_user_alive( id ) || !bSlow[ id ] ){
                return PLUGIN_CONTINUE;
        }
       
        new Float: fVeloc[ 3 ] ,
                Float: fOrigin[ 3 ] ,
                Float: SLOW_SPEED ;
       
        SLOW_SPEED        =        get_pcvar_float( pSlowSpeed );
               
        pev( id , pev_origin , fOrigin );
        pev( id , pev_velocity ,fVeloc  );
       
        if( !( -0.01 <= fVeloc[ 0 ] - oldVeloc[ id ][ 0 ] <= 0.01 ) ){
                fVeloc[ 0 ] -=        oldVeloc[ id ][ 0 ];
                fVeloc[ 0 ]        *= SLOW_SPEED;
               
                oldVeloc[ id ][ 0 ] += fVeloc[ 0 ];
        }
        if( !( -0.01 <= fVeloc[ 1 ] - oldVeloc[ id ][ 1 ] <= 0.01 ) ){
                fVeloc[ 1 ] -=        oldVeloc[ id ][ 1 ];
                fVeloc[ 1 ]        *= SLOW_SPEED;
               
                oldVeloc[ id ][ 1 ] += fVeloc[ 1 ];
        }
       
        new Float: fTimeSub        =        get_gametime() - fTime[ id ];
       
        fTime[ id ]        =        get_gametime();
       
        fOrigin[ 2 ]        -=        floatmul( fVeloc[ 2 ] , fTimeSub );
        fOrigin[ 2 ]        +=        floatmul( fVeloc[ 2 ] , fTimeSub * SLOW_SPEED );
       
        if( !( pev( id , pev_flags ) & FL_ONGROUND ) && ! ( pev( id , pev_flags ) & FL_PARTIALGROUND ) ){
               
                fVeloc[ 2 ] +=        floatmul( pev( id , pev_gravity ) * get_pcvar_float( pGrav ) , fTimeSub );
                fVeloc[ 2 ]        -=        floatmul( pev( id , pev_gravity ) * get_pcvar_float( pGrav ) , fTimeSub * SLOW_SPEED );
        }
       
        oldVeloc[ id ][ 2 ]        =        fVeloc[ 2 ];
       
        fTime[ id ]        =        get_gametime();
       
        engfunc( EngFunc_SetOrigin , id , fOrigin );
        set_pev( id , pev_velocity , oldVeloc[ id ] );
        set_pev( id , pev_framerate , SLOW_SPEED );
       
        engfunc( EngFunc_SetClientMaxspeed , id , g_fWeaponsSpeed[ get_user_weapon( id ) ] * SLOW_SPEED );
       
        return PLUGIN_CONTINUE;
}


Jhob94 08-08-2013 20:35

Re: SlowMotion
 
I will test it tomorrow :)

joropito 08-09-2013 17:21

Re: SlowMotion
 
That's slow speed, you have to reduce speed on everything (I mean frames)

Blizzard_87 08-10-2013 04:42

Re: SlowMotion
 
This might be stupid suggestion. But sv_maxspeed might help? I use it with my nuke strike section. Every thing slows down. Apart from if you jump. It does not slow down jumping.

Jhob94 08-10-2013 08:12

Re: SlowMotion
 
Well this was my idea:
When someone get hited twice with amount of 15hp each hit, all get slow for 3 seconds and who was hited move normal and play a sound like adrenaline effect.


All times are GMT -4. The time now is 15:56.

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