addHook("PlayerThink", function(player)
	if player.mo then
		if player.skidtime or player.playerstate ~= PST_LIVE  or (player.pflags & PF_STARTDASH) or player.powers[pw_carry] or P_PlayerInPain(player) or player.powers[pw_nocontrol] or player.spectator or player.exiting or player.climbing or (player.pflags & PF_SLIDING) or (player.powers[pw_super] and mapheaderinfo[gamemap].doomsayfloat) then
			player.control = false
		else
			player.control = true
		end
	end
end)

addHook("PlayerThink", function(player)
	if player.mo and player.playerstate == PST_LIVE then
		
		if player.custom1tic == nil then
			player.custom1tic = 0
		end
		
		if player.custom2tic == nil then
			player.custom2tic = 0
		end
		
		if player.custom3tic == nil then
			player.custom3tic = 0
		end
		
		if player.spintic == nil then
			player.spintic = 0
		end
		
		if player.jumptic == nil then
			player.jumptic = 0
		end
	end
end)

addHook("PlayerThink", function(player)
	if player.mo and player.playerstate == PST_LIVE then
		
		if player.cmd.buttons & BT_CUSTOM1 and player.custom1tic < 100 then
			player.custom1tic = $ + 1
		elseif not (player.cmd.buttons & BT_CUSTOM1) then
			player.custom1tic = 0
		end
		
		if player.cmd.buttons & BT_CUSTOM2 and player.custom2tic < 100 then
			player.custom2tic = $ + 1
		elseif not (player.cmd.buttons & BT_CUSTOM2) then
			player.custom2tic = 0
		end
		
		if player.cmd.buttons & BT_CUSTOM3 and player.custom3tic < 100 then
			player.custom3tic = $ + 1
		elseif not (player.cmd.buttons & BT_CUSTOM3) then
			player.custom3tic = 0
		end
		
		if player.cmd.buttons & BT_SPIN and player.spintic < 100 then
			player.spintic = $ + 1
		elseif not (player.cmd.buttons & BT_SPIN) then
			player.spintic = 0
		end
		
		if player.cmd.buttons & BT_JUMP and player.jumptic < 100 then
			player.jumptic = $ + 1
		elseif not (player.cmd.buttons & BT_JUMP) then
			player.jumptic = 0
		end
	end
end)