----------------------------
-- CakeScript (March 29, 2008)
-- by LuaBanana
--
-- Alpha Version
-- cl_binds.lua
----------------------------
ContextEnabled = false;

function GM:PlayerBindPress( ply, bind, pressed )

	if(LocalPlayer():GetNWInt("charactercreate") == 1) then
	
		if(bind == "+forward" or bind == "+back" or bind == "+moveleft" or bind == "+moveright" or bind == "+jump" or bind == "+duck") then return true; end -- Disable ALL movement keys.
	
	end
	
--	if(string.find( bind, "impulse 100" )) then return true; end -- Disables flashlight
	
	if(bind == "+use") then
	
		local trent = LocalPlayer():GetEyeTrace().Entity;
		
		if(trent != nil and trent:IsValid() and CAKE.IsDoor(trent)) then
		
			LocalPlayer():ConCommand("rp_opendoor");
			
		end
		
	end
	
	if( ( bind == "+attack2" or bind == "+attack" ) ) then
		
		if( ply:GetNWInt( "tiedup" ) == 1 and not GUIClickerEnabled and ply:Alive() ) then	-- disable weapon use when tied up

			return true;
		end
	end
	
	-- TS code
	if( bind == "toggleconsole" ) then
		CloseChat();
		--gui.EnableScreenClicker( false );
	end
	-- TS code
	if( string.find( bind, "messagemode" ) ) then
		OpenChat();
		return true;
	end
	
	if( bind == "+jump" ) then
	
		if( LocalPlayer():GetNWFloat("sprint") <= 15 ) then
			return true;
		end
	
	end

end

function GM:ScoreboardShow()
	ContextEnabled = true;
	gui.EnableScreenClicker(true)
	CAKE.HiddenButton:SetVisible(true);
end

function GM:ScoreboardHide()
	ContextEnabled = false;
	gui.EnableScreenClicker(false);
	CAKE.HiddenButton:SetVisible(false);
end

