AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Increase player speed when ducking (https://forums.alliedmods.net/showthread.php?t=83031)

Sn!ff3r 01-03-2009 05:04

Increase player speed when ducking
 
Hi, I want to get same player speed when walking / ducking. How ?

SnoW 01-03-2009 06:32

Re: Increase player speed when ducking
 
Can I ask what is this? I wrote nice plugin here, AM tiled and my script is gone!
Didn't understand do you want walk speed when ducking, or run speed when ducking and walking, still...
You would check it in prethink, and just set the speed, also...
I think IN_WALK = !IN_RUN, !IN_DUCK, like this:
Code:

if((~pev(id, pev_button) & IN_DUCK) || (~pev(id, pev_oldbuttons) & IN_DUCK))
//And same with IN_RUN also...


ConnorMcLeod 01-03-2009 08:24

Re: Increase player speed when ducking
 
workaround :

Ask player if they allow your plugin to change their vars :

cl_forwardspeed, cl_backspeed, cl_sidespeed

If player say yes, change vars to sv_maxspeed value
Else, do what you want, kick of let them play.

PHP Code:

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Duck Speed"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

#define FACTOR    2.35

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_forward(FM_PlayerPreThink"PlayerPreThink")

    
set_cvar_float("sv_maxspeed"610.0)
}

public 
PlayerPreThink(id)
{
    if( 
pev(idpev_button) & IN_DUCK )
    {
        if( !(
pev(idpev_oldbuttons) & IN_DUCK) )
        {
            
cs_set_user_duckspeed(id)
        }
    }
    else
    {
        if( 
pev(idpev_oldbuttons) & IN_DUCK )
        {
            
cs_reset_user_maxspeed(id)
        }
    }
}

stock cs_reset_user_maxspeed(id)
{
    new 
Float:flMaxSpeed;
    switch ( 
get_user_weapon(id) )
    {
        case 
CSW_SG550CSW_AWPCSW_G3SG1 flMaxSpeed 210.0;
        case 
CSW_M249 flMaxSpeed 220.0;
        case 
CSW_AK47 flMaxSpeed 221.0;
        case 
CSW_M3CSW_M4A1 flMaxSpeed 230.0;
        case 
CSW_SG552 flMaxSpeed 235.0;
        case 
CSW_XM1014CSW_AUGCSW_GALILCSW_FAMAS flMaxSpeed 240.0;
        case 
CSW_P90 flMaxSpeed 245.0;
        case 
CSW_SCOUT flMaxSpeed 260.0;
        default : 
flMaxSpeed 250.0;
    }
    
engfunc(EngFunc_SetClientMaxspeedidflMaxSpeed);
    
set_pev(idpev_maxspeedflMaxSpeed);
}

stock cs_set_user_duckspeed(id)
{
    new 
Float:flMaxSpeed;
    switch ( 
get_user_weapon(id) )
    {
        case 
CSW_SG550CSW_AWPCSW_G3SG1 flMaxSpeed 210.0*FACTOR;
        case 
CSW_M249 flMaxSpeed 220.0*FACTOR;
        case 
CSW_AK47 flMaxSpeed 221.0*FACTOR;
        case 
CSW_M3CSW_M4A1 flMaxSpeed 230.0*FACTOR;
        case 
CSW_SG552 flMaxSpeed 235.0*FACTOR;
        case 
CSW_XM1014CSW_AUGCSW_GALILCSW_FAMAS flMaxSpeed 240.0*FACTOR;
        case 
CSW_P90 flMaxSpeed 245.0*FACTOR;
        case 
CSW_SCOUT flMaxSpeed 260.0*FACTOR;
        default : 
flMaxSpeed 250.0*FACTOR;
    }
    
engfunc(EngFunc_SetClientMaxspeedidflMaxSpeed);
    
set_pev(idpev_maxspeedflMaxSpeed);



leonard19941 07-01-2012 08:47

Re: Increase player speed when ducking
 
Connor, this would not SlowHack?

dFF 07-01-2012 08:57

Re: Increase player speed when ducking
 
01-03-09 07:24 AM

http://sergi1985.files.wordpress.com...llazo-azul.png

bibu 07-01-2012 11:34

Re: Increase player speed when ducking
 
Who cares about cl_speed slowhack? -.-

ConnorMcLeod 07-01-2012 12:43

Re: Increase player speed when ducking
 
Any setting change without client's permission is slowhack.
Can even consider HLGuard as slowhacking.

bibu 07-01-2012 13:43

Re: Increase player speed when ducking
 
blabla

leonard19941 07-01-2012 19:44

Re: Increase player speed when ducking
 
Quote:

Originally Posted by ConnorMcLeod (Post 1740466)
Any setting change without client's permission is slowhack.
Can even consider HLGuard as slowhacking.

So this would be considered SlowHack?

Neeeeeeeeeel.- 07-02-2012 00:39

Re: Increase player speed when ducking
 
Quote:

Originally Posted by ConnorMcLeod (Post 1740466)
Any setting change without client's permission is slowhack.
Can even consider HLGuard as slowhacking.



All times are GMT -4. The time now is 09:13.

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