1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

//----------------------------------------------------------------------------

// Team Fortress 2

// Press-and-hold crouch toggle

//

// sixx, april 2019

//

// Press-and-hold crouch bind to toggle crouch

// always-on or off [default].

//

// // USAGE

//

// Press and hold crouch bind to lock crouch on --

// release the bind and you'll remain crouched.

//

// Press and release bind to unlock crouch.

//

// Quickly pressing and releasing bind functions

// like game default.

//

// // SETTINGS

//

// Set key bind on line 44,

// script default is Ctrl

//

// Set toggle delay on line 32,

// script default is 250.

//----------------------------------------------------------------------------



alias +duckt "dt_set"

alias -duckt "dt_reset"



alias dt_set "+duck; alias dt_exec dt_setB; alias dt_reset dt_resetB; wait 250; dt_exec"

alias dt_setB "alias dt_reset; alias +duckt dt_unset"



alias dt_unset "alias dt_reset dt_resetB; alias +duckt dt_set"



alias dt_exec // "dt_setB"



alias dt_reset // "dt_resetB"

alias dt_resetB "alias dt_exec; -duck"



// overwrite current crouch bind

// bind "Shift" "+duckt"

bind "Ctrl" "+duckt"





//--------------------

// Simple wait test

// Must be connected to a server to work.

//

// If the server does not have wait enabled,

// the bind reverts to normal +duck action.

//--------------------

alias wait "alias +duckt +duck; alias -duckt -duck"

wait