local cv_drifthop = CV_RegisterVar({ //This registers a cvar (console variable)! This allows you to toggle it through the console or the Addon Settings menu. name = "drifthop", //Sets the name for the cvar. This is what you type in the console before the value. defaultvalue = "1", //This is the default value for the variable, what it will initally start as. flags = 132, //These are the console variable flags represented by adding their integers. PossibleValue = CV_OnOff, //Sets the type of possible values the cvar can receive. description = "Toggles the Drift Hopping system." //The description that appears in the Addon Settings menu. }) local cv_hopheight = CV_RegisterVar({ name = "drifthopheight", defaultvalue = "5", flags = 132, PossibleValue = {MIN = 1, MAX = 50}, description = "Sets the height of the Drift Hop." }) local cv_hopnerf = CV_RegisterVar({ name = "drifthopnerf", defaultvalue = "1", flags = 132, PossibleValue = CV_OnOff, description = "If on, reduces your speed everytime you do a Drift Hop." }) local function SpindashInput(player) if cv_drifthop.value == 0 then //If the cvar value is 0... return //Just skip this code. end if player.cmd.buttons == (BT_DRIFT|BT_ACCELERATE|BT_BRAKE) then //If you're pressing the inputs for a spindash... player.spindashused = true //Set this bool to true that lets you know the spindash is being used! else player.spindashused = false //Otherwise, set it to false. end end local function HopSetup(player) if P_IsObjectOnGround(player.mo) then //If you're on the ground... if cv_hopnerf.value == 1 player.mo.momx = 4 * $ / 5 player.mo.momy = 4 * $ / 5 end player.mo.momz = cv_hopheight.value * P_MobjFlip(player.mo) * mapobjectscale //Sets your Z-Momentum to the value set by cv_hopheight multiplied by the mobj scale of the map! S_StartSound(player.mo, sfx_bhog00) //Play a sound effect for the jump! end end local function DoHop(player) if cv_drifthop.value == 0 then //If the cvar value is 0... return //Just skip this code. end if player.itemtype == 22 return end if (player.cmd.buttons & BT_DRIFT) then //If you're pressing drift... if not player.tappedinput and not player.spindashused //...and you're not tapping the button OR using the inputs for a spindash... HopSetup(player) //Start the function for doing hops! end player.tappedinput = true //This line checks if you press the drift button once! else player.tappedinput = false //The following tic, it no longer checks the drift button, so you don't repeat-hop if you hold the button. end end local function PrintValues(player) print(player.itemtype) end addHook("PlayerThink", SpindashInput) addHook("PlayerThink", DoHop) //addHook("PlayerThink", PrintValues)