local DoorCost = 0;

usermessage.Hook( "RDC", function( um )
	DoorCost = um:ReadLong();
end );

concommand.Add( "eps_buydoormenu", function()
	local Door = LocalPlayer():TraceDoor( 90 )
	
	if ( !Door ) then
		return;
	end;
	
	eps_DermaQuery( "DefaultBold", "Do you want to buy this door for " .. DoorCost .. epsilonScript.Config:Get( "Currency" ) .. " ", "Buy Door",
		"Buy", function() LocalPlayer():ConCommand( "eps_buydoor " .. Door:EntIndex() ) end,
		"Nevermind", function() end
	);
end );

concommand.Add( "eps_doorproperties", function()
	local Door = LocalPlayer():TraceDoor( 90 );
	
	if ( !Door ) then
		return;
	end;
	
	eps_DermaQuery( "DefaultBold", "Set the doors title or sell the door?", "Buy Door",
		"Set Door Title", function() Derma_StringRequest( "Door Title", "Set the door title", "", function( strTextOut ) LocalPlayer():ConCommand( "eps_namedoor \"" .. strTextOut .. "\" " .. Door:EntIndex() ) end, function( strTextOut )end, "Accept", "Cancel" ) end,
		"Sell Door", function() LocalPlayer():ConCommand( "eps_selldoor " .. Door:EntIndex() ) end,
		"Cancel", function() end
	);
end );

concommand.Add( "eps_givemoneymenu", function()
	local Player = LocalPlayer():TracePlayer( 80 );
	
	if ( Player:IsValid() ) then
		Derma_StringRequest( "Give Money", "Give '" .. Player:Name() .. "' money!", "", function( strTextOut ) LocalPlayer():ConCommand( "eps_givemoney " .. strTextOut ) end, function( strTextOut )end, "Accept", "Cancel" );
	end;
end );
