addHook("PlayerThink", function(player) // Make sure that it runs
    if cv_fademomvar.value
    and FixedHypot(player.mo.momx, player.mo.momy) >= FixedMul(player.runspeed, player.mo.scale) // Check if the player is moving faster than their run
    and (player.cmd.forwardmove or player.cmd.sidemove) // Is the player purposely moving?
        player.mo.friction = FRACUNIT // Make the momentum happen
    end // Finish this if statement
end) // Close this hook

addHook("PlayerThink", function(player) // Make sure that it runs
    if cv_fademomvar.value
    and FixedHypot(player.mo.momx, player.mo.momy) >= FixedMul(player.runspeed, player.mo.scale) // Check if the player is moving faster than their run
    and (player.cmd.forwardmove or player.cmd.sidemove) // Is the player purposely moving?
        player.mo.friction = $1 - FRACUNIT/1500// Make the momentum happen
    end // Finish this if statement
end) // Close this hook

rawset(_G, "cv_fademomvar", CV_RegisterVar({
    name = "custommomentum",
    defaultvalue = 1,
    flags = 0,
    PossibleValue = CV_YesNo,
    func = 0,
}))